Dead fish
Jump to navigation
Jump to search
- Not to be confused with Deadfish.
- The title of this article is not correct because of technical limitations. The correct title is actually ><x>.
><x> (Pronounced "Dead fish") is a 2D esolang created by User:None1, it is a cross between Deadfish and ><>, but the i
command in ><> is l
in ><x>.
Commands
Command | Meaning | Derives from |
---|---|---|
i | Increments the accumulator | Deadfish |
d | Decrements the accumulator | Deadfish |
s | Squares the accumulator | 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 | ><> |
? | If accumulator is zero, skip next instruction | ><> |
; | Halts the program | ><> |
space | NOP | ><> |
A ><x> program terminates if and only if:
- The IP is out of bound.
- The IP hits
;
. - The IP hits an invalid character, in this case, the program prints
Nope.
before terminating.
It uses only one wrapping accumulator that contains numbers from 0
to 255
, and the IP is at the top left and its direction is initially right.
Examples
Hello World
iiisdsiiiiiiiioiiiiiiiiiiiiiiiiiiiiiiiiiiiiioiiiiiiiooiiiodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddoddddddddddddodddddddddddddddddddddsddoddddddddoiiioddddddoddddddddodddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddo
Cat Program (never terminates)
>lov ^ <
Truth Machine
lddddddddddddddddddddddddddddddddddddddddddddddddn?v >n<
A smaller version that takes advantage of the accumulator being bound to the range [0, 255]
ls?vn; >sss>n<
An even smaller version in Codegolf Stack Exchange
lssss>n?<
Quine
Nope.
Nope. interpreter
Nope.
or simply
a
Count backwards from 100 to 1
iiiiiiiiiis>nd?v ^ <
Count forwards from 1 to 100
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd>iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiindddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd?v ^ <
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 'i':{ x++; break; } case 'd':{ x--; break; } case 's':{ x*=x; break; } case 'n':{ std::cout<<int(x)<<std::endl; break; } 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 '?':{ if(x) break; ipx+=ipdx; ipy+=ipdy; break; } case ';':{ return 0; } case ' ':{ break; } default:{ std::cout<<"Nope."; return 0; } } ipx+=ipdx; ipy+=ipdy; } return 0; }