Advertisement Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  


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 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:

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

Sign in to follow this  


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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!