gistfile1.txt
· 2.0 KiB · Text
Raw
Playground
||:@include: lib/rpn.nv
|:rewind: yes? :playfield: ___ | :behind: ___
:: increment playfield size
|:comment: if theres a dot in front of pac eat it |
|:rewind: yes? :playfield: (pacman dot) |
:behind: ___
:: increment playfield size
:playfield: pacman
|:comment: if theres a ghost in front of pac eat it |
|:rewind: yes? :playfield: (pacman ghost) |
:behind: ___
:: increment playfield size
:playfield: pacman
|:comment: if pac hits a wall set the done flag |
|:rewind: yes? :playfield: (pacman wall) | :status: done
:ahead: (wall pacman)
:: increment playfield size
:: increment playfield size
|:comment: otherwise move everything to the tracking tapes |
|:rewind: yes? :playfield: pacman | :ahead: pacman
:: increment playfield size
|:rewind: yes? :playfield: dot | :ahead: dot
:: increment playfield size
|:rewind: yes? :playfield: dot | :ahead: ghost
:: increment playfield size
|:rewind: yes :playfield: wall | :ahead: wall
:: increment playfield size
|:comment: use RPN for counting |
|:: increment playfield size :@rpn data: $id |
:playfield size: $id
|:: increment playfield size? :playfield size: $id |
:@rpn: ($id 1 +)
|:comment: make a note of how long the playfield was |
|:: :ahead: wall? :playfield size: $limit |
:layout: ahead
:full run: $limit
|:comment: restore the playfield from the tapes |
|:layout: ahead :ahead: pacman | :playfield: pacman
:layout: behind
:: decrement playfield size
|:layout: ahead? :ahead: $a | :playfield: $a
:: decrement playfield size
|:layout: behind? :behind: $b | :playfield: $b
:: decrement playfield size
|:full run: $x |:playfield size: $x
|:: decrement playfield size :@rpn data: $id |
:playfield size: $id
|:: decrement playfield size? :playfield size: $id |
:@rpn: ($id 1 -)
|:comment: check if the frame is done and if the run is done |
|:playfield size: 0? :layout: $x :status: done | :rewind: no
|:playfield size: 0? :layout: $x | :rewind: yes
|| :playfield: (___ ___ pacman dot dot dot ghost dot wall)
|| :playfield size: 0
|| :rewind: yes
| 1 | ||:@include: lib/rpn.nv |
| 2 | |
| 3 | |:rewind: yes? :playfield: ___ | :behind: ___ |
| 4 | :: increment playfield size |
| 5 | |
| 6 | |:comment: if theres a dot in front of pac eat it | |
| 7 | |:rewind: yes? :playfield: (pacman dot) | |
| 8 | :behind: ___ |
| 9 | :: increment playfield size |
| 10 | :playfield: pacman |
| 11 | |
| 12 | |:comment: if theres a ghost in front of pac eat it | |
| 13 | |:rewind: yes? :playfield: (pacman ghost) | |
| 14 | :behind: ___ |
| 15 | :: increment playfield size |
| 16 | :playfield: pacman |
| 17 | |
| 18 | |:comment: if pac hits a wall set the done flag | |
| 19 | |:rewind: yes? :playfield: (pacman wall) | :status: done |
| 20 | :ahead: (wall pacman) |
| 21 | :: increment playfield size |
| 22 | :: increment playfield size |
| 23 | |
| 24 | |:comment: otherwise move everything to the tracking tapes | |
| 25 | |:rewind: yes? :playfield: pacman | :ahead: pacman |
| 26 | :: increment playfield size |
| 27 | |:rewind: yes? :playfield: dot | :ahead: dot |
| 28 | :: increment playfield size |
| 29 | |:rewind: yes? :playfield: dot | :ahead: ghost |
| 30 | :: increment playfield size |
| 31 | |:rewind: yes :playfield: wall | :ahead: wall |
| 32 | :: increment playfield size |
| 33 | |
| 34 | |:comment: use RPN for counting | |
| 35 | |:: increment playfield size :@rpn data: $id | |
| 36 | :playfield size: $id |
| 37 | |:: increment playfield size? :playfield size: $id | |
| 38 | :@rpn: ($id 1 +) |
| 39 | |
| 40 | |:comment: make a note of how long the playfield was | |
| 41 | |:: :ahead: wall? :playfield size: $limit | |
| 42 | :layout: ahead |
| 43 | :full run: $limit |
| 44 | |
| 45 | |:comment: restore the playfield from the tapes | |
| 46 | |:layout: ahead :ahead: pacman | :playfield: pacman |
| 47 | :layout: behind |
| 48 | :: decrement playfield size |
| 49 | |:layout: ahead? :ahead: $a | :playfield: $a |
| 50 | :: decrement playfield size |
| 51 | |:layout: behind? :behind: $b | :playfield: $b |
| 52 | :: decrement playfield size |
| 53 | |
| 54 | |:full run: $x |:playfield size: $x |
| 55 | |:: decrement playfield size :@rpn data: $id | |
| 56 | :playfield size: $id |
| 57 | |:: decrement playfield size? :playfield size: $id | |
| 58 | :@rpn: ($id 1 -) |
| 59 | |
| 60 | |:comment: check if the frame is done and if the run is done | |
| 61 | |:playfield size: 0? :layout: $x :status: done | :rewind: no |
| 62 | |:playfield size: 0? :layout: $x | :rewind: yes |
| 63 | |
| 64 | || :playfield: (___ ___ pacman dot dot dot ghost dot wall) |
| 65 | || :playfield size: 0 |
| 66 | || :rewind: yes |