StackFck2d
As you may or may not know, ive always been interested in languages/compilers/interprets so I did my weekly x hour codeathon (this weekend it was 2 hours)...and StackFck2d was born!
Its just like Brainfck but with 6 new commands...here is the complete listing of commands:
Now, let me explain the new aspects. Its not 1d like BF, this is 2d. You can move in 4 directions instead of 2. Also, each "cell" is now a stack. When you use + and -, you affect the top of the stack. There are also 2 commands for coping and pasting cells.
I did this in 2 hours so the code is ugly, crammed into 2 functions, and may not work 100%! The loops is the only aspect that may not work perfectly, but from my few tests, they worked. Here is the compiler with source:
StackFuck2d.zip
I know its not much and doesnt add much greatness to BF, but I wanted a project to mess around with in a short amount of time and learn some things about the STL. Have fun
;)
Its just like Brainfck but with 6 new commands...here is the complete listing of commands:
> moves the pointer east.
< moves the pointer west.
^ moves the pointer north.
v moves the pointer south.
+ increment (increase by one) the value(top of the stack) at the pointer.
- decrement (decrease by one) the value(top of the stack) at the pointer.
. output the value of the byte(top of the stack) at the pointer.
, accept one byte of input, storing its value in the top of the stack at the pointer.
[ jump forward to the command after the corresponding ] if the byte at the pointer is zero.
] jump back to the command after the corresponding [ if the byte at the pointer is nonzero.
@ pushes an empty cell onto the top of the location's stack
# pops the top most cell off of the location's stack
% copies the current location's value and places it into the global variable
& pastes the global variable's value into the current location's value
Now, let me explain the new aspects. Its not 1d like BF, this is 2d. You can move in 4 directions instead of 2. Also, each "cell" is now a stack. When you use + and -, you affect the top of the stack. There are also 2 commands for coping and pasting cells.
I did this in 2 hours so the code is ugly, crammed into 2 functions, and may not work 100%! The loops is the only aspect that may not work perfectly, but from my few tests, they worked. Here is the compiler with source:
StackFuck2d.zip
I know its not much and doesnt add much greatness to BF, but I wanted a project to mess around with in a short amount of time and learn some things about the STL. Have fun
;)
0
Sign in to follow this
Followers
0
0 Comments
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now