From eaac2ac0850a3971b505f4c61d24938ac202cad8 Mon Sep 17 00:00:00 2001 From: Sanzhar <102561322+skantay@users.noreply.github.com> Date: Sat, 17 Feb 2024 06:24:38 +0600 Subject: [PATCH] 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 --- subjects/brainfuck/README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/subjects/brainfuck/README.md b/subjects/brainfuck/README.md index 9231a8950..ccea1359c 100644 --- a/subjects/brainfuck/README.md +++ b/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. -Every operator consists of a single character: -- `>`: increment the pointer. -- `<`: decrement the pointer. -- `+`: increment the pointed byte. -- `-`: decrement the pointed byte. -- `.`: print the pointed byte to the standard output. -- `[`: if the pointed byte is 0, then instead of moving onto the next command, skip to the command after the matching `]`. -- `]`: if the pointed byte is **not** 0, then instead of moving onto the next command, move back to the command after the matching `[`. +Every operator consists of a single character : + + '>' increment the pointer + '<' decrement the pointer + '+' increment the pointed byte + '-' decrement the pointed byte + '.' print the pointed byte on standard output + '[' 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.