-
Notifications
You must be signed in to change notification settings - Fork 0
/
program.bf
84 lines (71 loc) · 1.19 KB
/
program.bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
+++++ +++++ +++++ +++++ +++++ + 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
]