summaryrefslogtreecommitdiff
path: root/test_programs/brainfuck/truth_machine.bf
blob: 964de9fef58479d04f2dcf10f0d7734de2ec86fb (plain)
1
2
3
4
5
6
7
my own personal attempt at making a truth machine in brainfuck
>+++++++++++++++++++++++++++++++++++++++++++++++++ set memory cell 1 to 49 (ascii code for '1')
<, move back to cell 0 and read the byte
------------------------------------------------ subtract 48 to test if it was '0'
[ if it wasn't zero
>.< output value of cell 1 and move back (loops forever)
]>-. otherwise subtract 1 from cell 0 and output the value (ascii code for '0')