-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbrainfuck.txt
44 lines (43 loc) · 3.01 KB
/
brainfuck.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
! v<
| .|
#--^
:p">++++++++[<+++++++++>-]<.>++++[<+++++++>-]<+.+++++++..+++.>>++++++[<+++++++>-]<+"
:p"+.------------.>++++++[<+++++++++>-]<+.<.+++.------.--------.>>>++++[<++++++++>-"
:p"]<+."
:
:++→0o
>. .
| >-v |
| >-#-----?C#-------->#-------?#>------------------------------v V
| p-----++ :p">"= :←1p1+→1 |:←1p0< :←1p1+→1 | o
| : |>-#-----?C#--------^ v x-#----v
+-p | :p"<"= :←1p1-→1 >. . >. . >->o :p1+ |
. | : |>-#-----?C#--------⸘>#--->-#---------?->#-------->-#---------^ | >p
+#-->+#------++ :p"+"= :←1p2+← :p0 :p1+dp255> :sp256-s :←1p2+→ | | |:
:p0 |:←0d1% |>-#-----?C#--------⸘>#--->-#---------?->#-------->-#---------^ | |:
:p0 | | :p"-"= :←1p2+← >.:p0 . :p1-dp0< >. :sp256+s . :←1p2+→ | |:
:→1 | |>-#-----?-#----------v >-------------v >------------->#---+-v |:
| v#----++ :p"["= :←1p2+→-1 . >¿---v | >#--->>+ |:p1+ +----^:
| |:←1p2 >+#-----?-#--------. || v-<-< | .v |:so | | | :
| |:+← |:p"]"= :←1p2+→-1 .>^| | ?--^ .>?#----^ | | :
| p +#-----?-v v#< +#--^ . :od | | :
| : .:p"."= +-------v |:d :p1+←0d1%p"]"≠ | | :
| . >---->----------------------------------------^ | :
^-------------------------------------------------------------------------------< :
v----<
H?#-----. | | . . .
:p""= vv-Cf+ C >--+p >--^
p----------------+-«o ^#< | : |
: | ^ :←1p2+← | . : | .
: >--^ | +C#-----⸘#---v | +C#-----⸘#---v
: ^«o :←-1← |:p0 | ^«o :←-1← |:p0 |
: ^ v | ^ v |
: ^--------<----< ^--------<----<
:
: This example is a working brainfuck interpreter. Simply input your brainfuck at the beginning of the
: circuit and let the machine run; it'll print the result values to the bottom left. It currently does
: not handle input (,) though, but that isn't required to prove that this language is Turing Complete.
:
: If you plan on actually running this example yourself, make sure to set the "ITERATIONS_PER_FRAME"
: to a high value (something like 1000), or you'll be waiting a while. The setting can be changed by
: running the command line tool with the "--mult" option.