-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02-a.ldpl
45 lines (38 loc) · 876 Bytes
/
02-a.ldpl
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
data:
auxText is text
pc is number
opcode is number
inA is number
inB is number
out is number
programText is text list
program is number list
procedure:
load file "02.txt" in auxText
split auxText by "," in programText
for each auxText in programText do
trim auxText in auxText
store auxText in out
push out to program
repeat
store 12 in program:1
store 2 in program:2
while 0 is equal to 0 do
store program:pc in opcode
if opcode is equal to 99 then
break
end if
in pc solve pc + 1
store program:program:pc in inA
in pc solve pc + 1
store program:program:pc in inB
in pc solve pc + 1
if opcode is equal to 1 then
in out solve inA + inB
else if opcode is equal to 2 then
in out solve inA * inB
end if
store out in program:program:pc
in pc solve pc + 1
repeat
display program:0 crlf