Browse Source

upd: README.md. better instructions, more clear.

`if the pointed byte is 0, then instead of moving onto the next command, skip to the command after the matching ].` this statement is confusing
pull/2445/head
Sanzhar 9 months ago committed by GitHub
parent
commit
eaac2ac085
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 18
      subjects/brainfuck/README.md

18
subjects/brainfuck/README.md

@ -10,14 +10,16 @@ The source code will be given as the first parameter, and will always be valid w
Your `Brainfuck` interpreter will consist of an array of 2048 bytes, all initialized to 0, with a pointer to the first byte. Your `Brainfuck` interpreter will consist of an array of 2048 bytes, all initialized to 0, with a pointer to the first byte.
Every operator consists of a single character: Every operator consists of a single character :
- `>`: increment the pointer.
- `<`: decrement the pointer. '>' increment the pointer
- `+`: increment the pointed byte. '<' decrement the pointer
- `-`: decrement the pointed byte. '+' increment the pointed byte
- `.`: print the pointed byte to the standard output. '-' decrement the pointed byte
- `[`: if the pointed byte is 0, then instead of moving onto the next command, skip to the command after the matching `]`. '.' print the pointed byte on standard output
- `]`: if the pointed byte is **not** 0, then instead of moving onto the next command, move back to the command after the matching `[`. '[' go to the matching ']' if the pointed byte is 0 (loop start)
']' go to the matching '[' if the pointed byte is not 0 (loop end)
Any other character is a comment. Any other character is a comment.

Loading…
Cancel
Save