Skip to content

Instantly share code, notes, and snippets.

@Deamon5550
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save Deamon5550/0324add2b04bb6938694 to your computer and use it in GitHub Desktop.

Select an option

Save Deamon5550/0324add2b04bb6938694 to your computer and use it in GitHub Desktop.
+++++ +++++ +++++ +++++ +++++ + number of inputs
>
>+++++ ++++
[
<+++++ +++++
>-
]
<+++++ ++ set array(1) to 97 to shift letters to be 0 based
<
>>>>> >>>>>>> build array 16|8|4|2|1
++++ ++++ ++++ ++++>
++++ ++++>
++++>
++>
+>
>>++++[
<<+++++ +++++>+++++ +++++>
-]
<+++++<++ create * and dash characters after array
<
< < < <
<<<<< <<<<<<<
[
>>>>, read input
<[-]<[-]<[->+>+<<]>[-<+>] copy 97
>[->-<]> subtract 97 from c (pointing at c)
>[-]>[-]<<
[->+>+<<]>>[-<<+>>]< copy c (pointing at cc)
<<[-]+++++ create counter for bitwise operations
[
>>[-]>[-]<<[->+>+<<]>>[-<<+>>]< copy c
>[-]<<<<[-]>>>> >>>>>>
[-<<<<<<+<<<<+>>>>>>>>>>] copy array(0) to y
>[-<+>] shift array
>[-<+>]
>[-<+>]
>[-<+>]
<<<< <<<[-]<<< < zero flag on way out
pointing to x
[
>-
>[-]+>[-]<< t3=1 t4=0
[>-]>[
if y == 0
>>[-]+<< set flag to 1
<<[-]+>> set x to 1 to break loop
>]<<
<-
] pointing to x
>>>> goto flag
>[-]+>[-]<< t5=1 t6=0
[
if flag != 1
>>>> >>>>.<<<< <<<< print *
<<<< <<<[->>-<<]>>> >>>>
>-]>[
else
>>>> >>>>.<<<< <<<< print dash
>]<<
<<<<
<<-] bitcount sub 1
>>>>> >>>> reset bit value array
++++ ++++ ++++ ++++>
++++ ++++>
++++>
++>
+ < < < <
<<<<< <<<<
<<<-
>>[-]+++++ +++++.<< print newline
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment