# memory is Uint8 with 8 cells # program will run until it hits @, and will wrap if it goes of either edge # : memory[ptr] += stepSize # ; if direction == "right" ptr += 1 else ptr -= 1 # | reverses the mp direction, stepSize *= -1 # ^ if memory[ptr] == memory[ptr + 1] it keeps direction, else it reverses # v the same as ^, with the directions reversed # . prints "$(memory[ptr]) " # , prints "$(char(memory[ptr]))" # @ ends the program # # skips the next instruction # _ starts comment mode, ignores all instructions until next _ # Hello World # program = ";; ::::: :::: ;;;; ;; #| #_::::: ::: #_ ; :# ^ ;;;; ;;; , ::::: ::::: ::::: ::::: ::::: ::::,::::: ::,,:::, _|_# _ #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: _# |_,;;;;; ::::: :::: ;;;; ;; #| #_::::: ::: #_ ; :# ^ ;;;; ;;; ::::: ::::: ::::: , ::::: ::::: ::::: ::::: ::::,:::, _|_# _ #: #: #: #: #: #: _# |_,_|_# _ #: #: #: #: #: #: #: #: _# |_,_|_# _ #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: #: _# |_,@" # 255 -> 0 # program = "|@.^.#:^" # Alphabet # program = "::::::::#| #_;:;::::::::#_^;;:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,:,@"