Tare

From Esolang
Jump to navigation Jump to search

Tare or 'tis a random esolang is an esolang invented by User:None1. Its specification changes every second because it is generated from the UNIX timestamp.

It uses a pseudo random generator to generate from a seed, by default it is the UNIX timestamp, but you can pass the seed as a command line argument to generate the seed.

Example languages

Language generated by seed 1

Name of esolang: Vdb

Vdb is an esolang, it has a deque and a tape.

It has 4 commands.

  • Z - Add deque back by 54.
  • 6 - If pointer is 71, multiply pointer by deque back.
  • c - If pointer isn't 56, input current cellas ASCII.
  • Y - If pointer is 23, floor divide deque back by 82.

Language generated by seed 1708330440

Name of esolang: Bcfjajvcz

Bcfjajvcz is an esolang, it has a queue, a stack and a tape.

It has 7 commands.

  • ( - Push pointer into current cell.
  • O - If queue front is 72, add stack top by 11.
  • r - Push current cell into current cell.
  • 4 - Decrement current cell.
  • b - If queue front is 33, print 23 as decimal.
  • : - Pop queue front and discard it.
  • i - If queue front is 21, pop current cell and discard it.

Language generated by seed 1708330325

Name of esolang: Ghrseg

Ghrseg is an esolang, it has a stack and a tape.

It has 10 commands.

  • > - If current cell isn't 59, push 80 into stack top.
  • Y - If stack top isn't 58, subtract stack top by 7.
  • D - If stack top is 83, print "dgff YarH".
  • T - Increment stack top.
  • G - Decrement current cell.
  • y - Multiply stack top by 43.
  • F - Push current cell into stack top.
  • p - Multiply stack top by pointer.
  • , - Decrement pointer.
  • c - Print "rG".

Language generated by seed 123456

Name of esolang: Eqntzu

Eqntzu is an esolang, it has a deque, a stack and a tape.

It has 3 commands.

  • 0 - If deque front isn't 40, increment current cell.
  • % - If pointer isn't 93, print 64 as decimal.
  • ' - Multiply current cell by pointer.

You can see that, most esolangs generated by seeds are pretty stupid.

Generator

The badly coded generator is written in C++:

#include<bits/stdc++.h>
using namespace std;
long long _seed;
int rnd(){
	_seed=(_seed*65537+1000000007)%2147483647;
	return _seed;
}
int randint(int l,int r){
	return rnd()%(r-l+1)+l;
}
string datastr[]={"tape","stack","queue","deque"};
set<string> chosen_datastr;
vector<char> chs;
vector<int> ops;
vector<string> pos;
char s[100];
string getpos(bool writable){
	int r=randint(1,100);
	int k=randint(0,1);
	if(k&&!writable){
		sprintf(s,"%d",r);
		return string(s);
	}
	return pos[randint(0,pos.size()-1)];
}
int main(int argc,char *argv[]){
	if(argc>1){
		for(int i=0;argv[1][i];i++){
			_seed=(_seed*10+argv[1][i]-48)%2147483647;
		}
	}else{
		_seed=time(0);
	}
	cout<<"Seed: "<<_seed<<'\n';
	string name;
	int len=randint(3,10);
	name+=char(randint(65,90));
	for(int i=1;i<len;i++){
		name+=char(randint(97,122));
	}
	cout<<"Name of esolang: "<<name<<'\n';
	cout<<name<<" is an esolang, it has ";
	for(int i=0;i<=8;i++) ops.push_back(i);
	for(int i=0;i<4;i++){
		if(randint(0,1)||(chosen_datastr.empty()&&i==3)){
			chosen_datastr.insert(datastr[i]);
			if(i==0){
				pos.push_back("current cell");
				pos.push_back("pointer");
			}
			if(i==1){
				pos.push_back("stack top");
				ops.push_back(9);
				ops.push_back(10);
			}
			if(i==2){
				pos.push_back("queue front");
				ops.push_back(9);
				ops.push_back(10);
			}
			if(i==3){
				pos.push_back("deque front");
				pos.push_back("deque back");
				ops.push_back(9);
				ops.push_back(10);
			}
		}
	}
	int cnt=0;
	for(auto i:chosen_datastr){
		++cnt;
		if(cnt==chosen_datastr.size()&&chosen_datastr.size()!=1) cout<<" and ";
		else if(cnt!=1) cout<<", ";
		cout<<"a "+i;
	}
	cout<<".\n";
	int num_commands=randint(2,20);
	cout<<"It has "<<num_commands<<" commands.\n";
	for(int i='!';i<='~';i++) chs.push_back(i);
	for(int i=1;i<=num_commands;i++){
		cout<<"* ";
		int num=randint(0,chs.size()-1);
		cout<<chs[num]<<" - ";
		chs.erase(chs.begin()+num);
		bool hasif=0;
		if(randint(0,1)){
			hasif=1;
			string pos=getpos(1);
			bool is=randint(0,1);
			int val=randint(1,100);
			cout<<"If "+pos+" "<<(is?"is":"isn\'t")<<" "<<val<<", ";
		}
		int op=ops[randint(0,ops.size()-1)];
		switch(op){
			case 1:{
				cout<<(hasif?"increment":"Increment");
				cout<<' ';
				cout<<getpos(1);
				cout<<'.';
				break;
			}
			case 2:{
				cout<<(hasif?"decrement":"Decrement");
				cout<<' ';
				cout<<getpos(1);
				cout<<'.';
				break;
			}
			case 3:{
				cout<<(hasif?"add":"Add");
				cout<<' ';
				cout<<getpos(1);
				cout<<" by ";
				cout<<getpos(0);
				cout<<'.';
				break;
			}
			case 4:{
				cout<<(hasif?"subtract":"Subtract");
				cout<<' ';
				cout<<getpos(1);
				cout<<" by ";
				cout<<getpos(0);
				cout<<'.';
				break;
			}
			case 5:{
				cout<<(hasif?"multiply":"Multiply");
				cout<<' ';
				cout<<getpos(1);
				cout<<" by ";
				cout<<getpos(0);
				cout<<'.';
				break;
			}
			case 6:{
				cout<<(hasif?"floor divide":"Floor divide");
				cout<<' ';
				cout<<getpos(1);
				cout<<" by ";
				cout<<getpos(0);
				cout<<'.';
				break;
			}
			case 7:{
				cout<<(hasif?"print":"Print");
				cout<<' ';
				cout<<getpos(0);
				cout<<(randint(0,1)?" as decimal":" as ASCII");
				cout<<'.';
				break;
			}
			case 8:{
				cout<<(hasif?"input":"Input");
				cout<<' ';
				cout<<getpos(1);
				cout<<(randint(0,1)?" as decimal":" as ASCII");
				cout<<'.';
				break;
			}
			case 9:{
				cout<<(hasif?"push":"Push");
				cout<<' ';
				cout<<getpos(0);
				cout<<" into ";
				cout<<getpos(1);
				cout<<'.';
				break;
			}
			case 10:{
				cout<<(hasif?"pop":"Pop");
				cout<<' ';
				cout<<getpos(1);
				if(randint(0,1)){
					cout<<" and discard it";
				}else{
					cout<<" and store it into ";
					cout<<getpos(1);
				}
				cout<<'.';
				break;
			}
			default:{
				cout<<(hasif?"print":"Print");
				int l=randint(1,20);
				cout<<" ";
				cout<<'\"';
				string t="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm,.!? ";
				for(int i=1;i<=l;i++) cout<<t[randint(0,t.size()-1)];
				cout<<'\"';
				if(randint(0,1)) cout<<" and a line feed";
				cout<<'.';
				break;
			}
		}
		cout<<"\n";
	}
    return 0;
}

Computational class

It can be easily seen from the interpreter that, any esolang generated has absolutely no control flow, thus, Tare is total.

See also