Skip to content

Instantly share code, notes, and snippets.

@chubbc
Created December 6, 2022 23:39
Show Gist options
  • Save chubbc/4b8ea2091e8cc6642b3a867237c00fe6 to your computer and use it in GitHub Desktop.
Save chubbc/4b8ea2091e8cc6642b3a867237c00fe6 to your computer and use it in GitHub Desktop.
+++>+>>,>,>,<<<< initialise out to 3 / cnt to 1 / read in the first 3 value
[ loop until the cnt is 0
<+> increment out by 1
[-]++++++ set count to 6
> [-] >[-<+>] >[-<+>] >[-<+>] , <<<< shuttle everything along and read new element
> [->>>>+>+<<<<<] >>>>>[-<<<<<+>>>>>] <<<<<< move a into place
>> [->>>>+>+<<<<<] >>>>>[-<<<<<+>>>>>] <<<<<<< move b into place
>>>>>> [-<->]<[[-]<<<<<->>>>>] <<<<< neq
> [->>>>+>+<<<<<] >>>>>[-<<<<<+>>>>>] <<<<<< move a into place
>>> [->>>+>+<<<<] >>>>[-<<<<+>>>>] <<<<<<< move c into place
>>>>>> [-<->]<[[-]<<<<<->>>>>] <<<<< neq
> [->>>>+>+<<<<<] >>>>>[-<<<<<+>>>>>] <<<<<< move a into place
>>>> [->>+>+<<<] >>>[-<<<+>>>] <<<<<<< move d into place
>>>>>> [-<->]<[[-]<<<<<->>>>>] <<<<< neq
>> [->>>+>+<<<<] >>>>[-<<<<+>>>>] <<<<<< move b into place
>>> [->>>+>+<<<<] >>>>[-<<<<+>>>>] <<<<<<< move c into place
>>>>>> [-<->]<[[-]<<<<<->>>>>] <<<<< neq
>> [->>>+>+<<<<] >>>>[-<<<<+>>>>] <<<<<< move b into place
>>>> [->>+>+<<<] >>>[-<<<+>>>] <<<<<<< move d into place
>>>>>> [-<->]<[[-]<<<<<->>>>>] <<<<<
>>> [->>+>+<<<] >>>[-<<<+>>>] <<<<<< move b into place
>>>> [->>+>+<<<] >>>[-<<<+>>>] <<<<<<< move d into place
>>>>>> [-<->]<[[-]<<<<<->>>>>] <<<<<
]
[-]>[-]>[-]>[-]>[-]<<<<< [->>+<<]>> clean up
print out the number
>+[[-]<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->[-]>>+>+<<<]]]]]]]]]<]>>[>]++++++[-<++++++++>]>>]<<<[.[-]<<<]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment