1 set cell 1 to 61 # exit
2 set cell 2 to 94 minus 61=33 # up
3 set cell 3 to 118 minus 94=24 # down
5 cell 5 for currently at an exit: 1 if at an exit 0 otherwise
7 set cell 6 to 0 (current level)
8 set cell 7 to for height above ground min zero
9 set cell 8 to 0 (highest exit)
11 cell 10 for whether input has been dealt with: 0 for yes 1 for no
12 cell 11 for whether dealt with the height above zero cell
13 reserve cell 12 and higher for scratch
16 >+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++>++++++++++++++++++++++++
19 read character into cell 9
24 while cell 9 != 0 # have an input
31 # copy cell 1 to cell 0 using cell 4
36 subtract cell 0 from cell 9
37 [->>>>>>>>>-<<<<<<<<<]
40 while cell 9 != 0 # we're not at an exit
45 copy cell 2 to cell 0 using cell 4
50 subtract cell 0 from cell 9
51 [->>>>>>>>>-<<<<<<<<<]
59 while cell 9 != 0 # we're going down
63 copy cell 7 to cell 11 using cell 12
69 while cell 11 != 0 # above ground
95 have now dealt with the input so clear cell 9
101 while cell 5 != 0 # we're going up
111 ### if 6 == 0 or 7 != 0
114 # copy cell 6 to cell 11 using cell 12
115 <<<<<<[->>>>>+>+<<<<<<]
116 >>>>>>[-<<<<<<+>>>>>>]
134 # copy cell 7 to cell 11 using cell 13
135 <<<<[->>>>+>>+<<<<<<]
136 >>>>>>[-<<<<<<+>>>>>>]
149 # add cell 12 to cell 7
158 have now dealt with the non exit node
165 while cell 10 != 0 # at an exit
168 copy cell 7 to cell 12 using cell 13 (highest)
170 >>>>>>[-<<<<<<+>>>>>>]
172 while cell 12 != 0 (above ground level)
175 copy cell 8 to cell 11 using cell 13 (highest)
181 ### subtract 11 from 12 ensuring 12 gte 0
187 copy cell 12 to cell 14 using cell 15
216 add cell 12 to cell 8
225 read character into cell 9