Context
Assuming 0 is false and any other value is true, NOT can be evaluated using a mechanism similar to if / then / else : if true, then reset result; set result to 1 otherwise. This can be implemented using a mechanism similar to
if / then / else.
Initial state
- Memory: A, 0
- Cursor: first cell
- Input: any
Process
- Set second cell to 1
- While first cell is not null
- Reset first cell
- Reset second cell
- Copy second cell to first one
- Go back to first cell (optional)
Code
>+<[[-]>-<]>[-<+>]<
Final state
- Memory: not(A), 0
- Cursor: first cell
- Input: any
- Output: unchanged
Aucun commentaire:
Enregistrer un commentaire