Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Subleq/Logo/subleq.logo
Normal file
39
Task/Subleq/Logo/subleq.logo
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
make "memory (array 32 0)
|
||||
|
||||
to load_subleq
|
||||
local "i make "i 0
|
||||
local "line
|
||||
make "line readlist
|
||||
while [or (not empty? :line) (not list? :line)] [
|
||||
foreach :line [
|
||||
setitem :i :memory ?
|
||||
make "i sum :i 1
|
||||
]
|
||||
make "line readlist
|
||||
]
|
||||
end
|
||||
|
||||
to run_subleq
|
||||
make "ip 0
|
||||
while [greaterequal? :ip 0] [
|
||||
local "a make "a item :ip :memory
|
||||
make "ip sum :ip 1
|
||||
local "b make "b item :ip :memory
|
||||
make "ip sum :ip 1
|
||||
local "c make "c item :ip :memory
|
||||
make "ip sum :ip 1
|
||||
cond [
|
||||
[[less? :a 0] setitem :b :memory ascii readchar ]
|
||||
[[less? :b 0] type char item :a :memory ]
|
||||
[else
|
||||
local "av make "av item :a :memory
|
||||
local "bv make "bv item :b :memory
|
||||
local "diff make "diff difference :bv :av
|
||||
setitem :b :memory :diff
|
||||
if [lessequal? :diff 0] [make "ip :c]]]
|
||||
]
|
||||
end
|
||||
|
||||
load_subleq
|
||||
run_subleq
|
||||
bye
|
||||
Loading…
Add table
Add a link
Reference in a new issue