Skip to content

branbarh/BrainF-Interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BrainFuckInterpreter

Basic add modular (destructive):

, > ,
a   b

[-<+>] <

Info:

[START]: on CELL 1
[ROOM]: 2 CELLS
[FINISH]: on CELL 0
[RESULT]: on CELL 0
[DESTRUCTIVE?]: YES

Basic add modular (non-destructive):

, > , <
a   b

[>>+>+<<<-] >>> [<<<+>>>-] <<
[>+>+<<-] >> [<<+>>-] <

Info:

[START]: on CELL 0
[ROOM]: 4 CELLS
[FINISH]: on CELL 2
[RESULT]: on CELL 2
[DESTRUCTIVE?]: NO

Basic subtract modular (destructive):

, > ,
a   b

[-<->] <

Info:

[START]: on CELL 1
[ROOM]: 2 CELLS
[FINISH]: on CELL 0
[RESULT]: on CELL 0
[DESTRUCTIVE?]: YES

Factorial modular (WIP):

++++++++
> , <
  a

[->------<] > convert from ASCII value to actual number

[[->+>+<<]>>-] < spread out the number ("7" becomes "7"0"6"0"5"0"4"0"3"0"2"0"1"0"0...)

--  put the spread out number back together ("7"0"6"0"5"0"4"0"3"0"2"0"1"0"0... becomes "7"6"5"4"3"2"1"0"0...)
[
  ++
  [<<]>>
  [>]>[[-<+>]>>]
  <<<
  --
]
++

Info:

[START]: on CELL 1
[ROOM]: "a" CELLS
[FINISH]: on CELL ?
[RESULT]: on CELL ?
[DESTRUCTIVE?]: ?

Basic subtract modular (non-destructive):

, > , <
a   b

[>>+>+<<<-] >>> [<<<+>>>-] <<
[>->+<<-] >> [<<+>>-] <

Info:

[START]: on CELL 0
[ROOM]: 4 CELLS
[FINISH]: on CELL 2
[RESULT]: on CELL 2
[DESTRUCTIVE?]: NO

Basic if statement modular (destructive):

, > , <
a   b

[->-<] > SETUP

[ if (a !== b)
  do stuff
  
  return to cell 1
  [-] <->
]

<+

[ else
  do stuff
  
  return to cell 0
  [-]
]

Info:

[START]: on CELL 0 (before SETUP) or CELL 1 (after SETUP)
[ROOM]: ? CELLS
[FINISH]: on CELL ?
[RESULT]: on CELL ?
[DESTRUCTIVE?]: YES

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published