Release

Brainf**k interperter

1

LowRes Oranges are good 2019-11-10 06:06

Thank you to was8bit for helping me figure out how to upload programs!


So brainf**k is a super simple programming language with only 8 COMMANDS
That's microscopic compared to lowres nx. Which is why it's really easy to make a interpreter for. (By the way, I did not create the actual language. I just made the program for it!) Here are the 8 commands:

+ adds 1 to current cell
- subtracts 1 from current cell
> moves to next cell
< moves to previous cell
. Outputs acii value of current cell
, takes one letter input stores acii value of input in current cell
( start of loop
) end of loop
(Loops EXIT if the value of current cell=0)

Enjoy! 🙂🙂🙂🙂

Brainfuck.nx | Open in app
2019-11-10 06:06

Timo 2019-11-10 12:17

Please update your posts with real screenshots of your programs, otherwise it's very confusing.


Timo 2019-11-10 14:14 (Edited)

And here some programming hints: You can replace these lines...
IF R=0 THEN PRINT 0;
IF R=1 THEN PRINT 1;
IF R=2 THEN PRINT 2;
IF R=3 THEN PRINT 3;
IF R=4 THEN PRINT 4;
IF R=5 THEN PRINT 5;
IF R=6 THEN PRINT 6;
IF R=7 THEN PRINT 7;
IF R=8 THEN PRINT 8;
IF R=9 THEN PRINT 9;

.. .with ...

IF R>=0 AND R<=9 THEN PRINT R;

And all the lines for letters...

IF R=10 THEN PRINT "A";
IF R=11 THEN PRINT "B";
IF R=12 THEN PRINT "C";
...
IF R=35 THEN PRINT "Z";

... with ...

IF R>=10 AND R<=35 THEN PRINT CHR$(R-10+ASC("A"));

The last part looks a bit tricky. The function CHR$(x) returns the letter with ASCII code x. I calculate minus 10 because your R for letters starts at 10. Then I add the ASCII code for the letter "A" using the function ASC. So in the end it should have the same result as before but in only one line.


LowRes Oranges are good 2019-11-10 16:15

Oh I didn't realize there was a CHR$ function. Just like the original lowres! And I really should use better thumbnails.


Log in to reply.