Dead fish ±∔
(Redirected from Dead fish +- +.)
- The title of this article is not correct because of technical limitations. The correct title is actually ><x±∔>.
><x±∔> (Pronounced "Dead fish plus minus plus dot") is a 2D esolang created by User:None1, it is a cross between a cross between Deadfish and ><>, PlusOrMinus and PlusOrOutput, it has a lot of commands that do the same thing.
Commands
><x±∔> adds more commands from ><> and adds all the commands from PlusOrMinus and PlusOrOutput. It also adds the Deadfish command o
which becomes O
since o
is already used.
Commands
The new commands are marked red.
Command | Meaning | Derives from |
---|---|---|
i | Increments the accumulator | Deadfish |
+ |
Increments the accumulator | PlusOrMinus/PlusOrOutput |
- |
Outputs the accumulator as ASCII, then decrements the accumulator | PlusOrMinus |
. |
Outputs the accumulator as ASCII | PlusOrOutput |
d | Decrements the accumulator | Deadfish |
s | Squares the accumulator | Deadfish |
O |
Outputs the accmulator as decimal | Deadfish |
o | Outputs the accumulator as ASCII | ><> |
n | Outputs the accmulator as decimal | ><> |
l | Input a character and store its ASCII code in accumulator | ><> |
^ | IP direction up | ><> |
v | IP direction down | ><> |
< | IP direction left | ><> |
> | IP direction right | ><> |
# |
Skip next instruction | ><> |
? | If accumulator is zero, skip next instruction | ><> |
; | Halts the program | ><> |
space | NOP | ><> |
0-9 |
Set the accumulator to the corresponding number | ><> |
Examples
XKCD Random Number
4O
Print A
8s+.
Nope. interpreter
Nope.
Interpreter
C++
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<fstream> std::vector<std::string> code; int w,h,ipx,ipy,ipdx,ipdy=1; unsigned char x; signed main(int argc,char* argv[]){ if(argc==1) return std::cout<<"Needs an input file",0; std::string s; std::fstream f(argv[1],std::ios::in); while(std::getline(f,s)){ h++; w=std::max(w,(int)s.size()); code.push_back(s); } f.close(); for(auto i:code){ while(i.size()<w) i+=" "; } while(ipx>=0&&ipx<h&&ipy>=0&&ipy<w){ switch(code[ipx][ipy]){ case '+': case 'i':{ x++; break; } case '-': case 'd':{ if(code[ipx][ipy]=='-') std::cout<<char(x&255); x--; break; } case 's':{ x*=x; break; } case 'O': case 'n':{ std::cout<<int(x)<<std::endl; break; } case '.': case 'o':{ std::cout<<char(x&255); break; } case 'l':{ x=std::cin.get(); break; } case '^':{ ipdx=-1; ipdy=0; break; } case 'v':{ ipdx=1; ipdy=0; break; } case '<':{ ipdx=0; ipdy=-1; break; } case '>':{ ipdx=0; ipdy=1; break; } case '#': case '?':{ if(x&&code[ipx][ipy]=='?') break; ipx+=ipdx; ipy+=ipdy; break; } case ';':{ return 0; } case ' ':{ break; } case '0':x=0;break; case '1':x=1;break; case '2':x=2;break; case '3':x=3;break; case '4':x=4;break; case '5':x=5;break; case '6':x=6;break; case '7':x=7;break; case '8':x=8;break; case '9':x=9;break; default:{ std::cout<<"Nope."; return 0; } } ipx+=ipdx; ipy+=ipdy; } return 0; }