-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgobsprogram.b
114 lines (105 loc) · 1.62 KB
/
gobsprogram.b
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
[
Gob's program in Brainfuck(1.0)
An implementation of Gob's program in Brainfuck
Schematic of tape:
| Print Question | 'Y' | Input |7| "PENUS \n"|
]
tens digit of question
+++++ +++++[
> +++++ ++ G 71
> +++++ +++++ + o 111
> +++++ +++++ b 98
> ++++ ' 39
> +++++ +++++ + s 115
> +++ 32
> +++++ +++ P 80
> +++++ +++++ + r 114
> +++++ +++++ + o 111
> +++++ +++++ g 103
> +++++ +++++ + r 114
> +++++ +++++ a 97
> +++++ +++++ + m 109
> +++++ + : 58
> +++ 32
> +++++ ++++ Y 89
> +++++ / 47
> +++++ +++ N 78
> +++++ + ? 63
> + \n10
> +++ 32
<<<<< <<<<< <<<<< <<<<< <-
]
ones digit and print question
>+.G
>+.o
>--.b
>-.'
>+++++.s
>++.
>.P
>++++.r
>+.o
>+++.g
>++++. r
>---. a
>-. m
>--. :
>++.
>-. Y
>---. /
>--. N
>+++. ?
>. \n
<. ?
>>++.
If statement:
>
0[-]
>
1[-]
Put 'Y' in blank cell
+++++ +++++
[>
+++++ ++++
<-
]
>-
'Y' is in cell x
> ,
Input is in cell y
x==y perserving y by Jeffery Johnston
<[<+>-]+ copy x into 1 x = 1
>[<<-<+>>>-] copy y into 0, subtract y from 1
1 = 0 if x=y
<<<[>>>+<<<-] copy 0 into y
>[>-<[-]] subtract 1 from x if 1 neq 0
> points to 1 if x=y
Write "Penus \n" into next seven cells of memory
>> +++++ +++++
[>
+++++ +++>
+++++ +++++>
+++++ +++++ +>
+++++ +++++ ++>
+++++ +++++ +>
+++ >
+++ >
+
<<<<< <<
<-]
>
>+
>
>---
>+++++
>++
>++
Go back to x which holds result of if statement
<<<<< <<<<
Loop wil run if x is 1
[>>[-]
"Penus " seven times
+++++ ++[>.>.>.>.>.>.>.<<<<< <<-]
Newline
>>>>> >>> . <<<<< <<<<<
]