Skip to content

Instantly share code, notes, and snippets.

@raklaptudirm
Last active May 9, 2022 15:56
Show Gist options
  • Save raklaptudirm/08af8b06a60129152ccbeb3c9f0f5bd6 to your computer and use it in GitHub Desktop.
Save raklaptudirm/08af8b06a60129152ccbeb3c9f0f5bd6 to your computer and use it in GitHub Desktop.
Optimized Brainfuck Instruction Set
// value instructions
/* Set Value (offset, amount) */ memory[pointer+offset] = amount
/* Change Value (offset, amount) */ memory[pointer+offset] += amount
// i/o instructions
/* Input Byte (offset) */ memory[pointer+offset] = stdin.ReadByte()
/* Output Byte (offset) */ stdout.Write(string(memory[pointer+offset]))
// looping instructions
/* Start Loop (offset) */ pointer += offset; for memory[pointer] > 0 {
/* End Loop (offset) */ pointer += offset; }
// optimizing instructions
/* Multiply (target, source, factor) */ memory[pointer+target] += source * factor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment