-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.bf
54 lines (39 loc) · 1 KB
/
test.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
# ⚠️ Incomplete code 😢
# write a brain fuck program to collect 2 numbers and return the sum
# STEP 1 print("A:"):
# increase set p0 to 10, then begin a loop
# go to the p1, increase p1 by 6
# go back to p0, reduce by 1
# when p0 is 0, move to p1; p1 = 60
++++++++++[>++++++<-]>
# to print a, add 5 to p1
+++++.
# p1 is 65, reduce to 58
-------.
# lets reset p1 to 0
[--]
# move to p2 then ask for number. print the number out too so the user sees it, then move back to p0
>,.<<
# print new line; p0 is 10, then set back to 0
++++++++++.[--]
# STEP 2 print("B:"):
# increase set p0 to 10, then begin a loop
# go to the p1, increase p1 by 6
# go back to p0, reduce by 1
# when p0 is 0, move to p1; p1 = 60
++++++++++[>++++++<-]>
# to print a, add 6 to p1
++++++.
# p1 is 66, reduce to 58
--------.
# reset p1 to 0
[--]
# move to p3 then ask for numberm then move back to 0
>>,.<<<
++++++++++.[--]
# STEP 3 print A+B= 🤯
++++++++++[>++++++<-]>
+++++.
# p1 is 65, reduce to 43
<++++[>-----<-]>
--.