-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcount.adv
More file actions
49 lines (46 loc) · 1.13 KB
/
count.adv
File metadata and controls
49 lines (46 loc) · 1.13 KB
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
think "This counts from one to the numerical first command line argument"
e
take shovel
e
ne
n
take all from backpack
n
n
e
take first from cauldron
drop page
take page
w
n
n
e
think "add more and more dirt to scale, weighing it each time"
think "when no more dirt is available, the page gets put"
think "into the scale and the recursion stops"
erase page
write on page with pen "dig in bag with shovel"
write on page with pen "put last onto scale"
write on page with pen "push button"
write on page with pen "obey page in me"
obey page
think "we end up with one too many. kludge around it."
take last from scale
w
drop label
e
think "Now take each label to the drain and output the number"
think "By dropping the last and picking up the label,"
think "we drop the page when there's no more labels."
take dirt from scale
take page from scale
take first from scale
erase page
write on page with pen "w;n;e"
write on page with pen "put label into pipe"
write on page with pen "w;s;e"
write on page with pen "take first from scale"
write on page with pen "drop last"
write on page with pen "take label"
write on page with pen "obey page in me"
obey page