# HG changeset patch # User Michael Pavone # Date 1406369878 25200 # Node ID 8c26981aae8cb068ff7db8c3f610f68829029dd2 # Parent 968705fcb4c66e8d529a33c7f33459f7e8149b86 Last fixes for lightning round version of dotScanner.lm diff -r 968705fcb4c6 -r 8c26981aae8c code/dotScanner.lm --- a/code/dotScanner.lm Sat Jul 26 01:41:24 2014 -0700 +++ b/code/dotScanner.lm Sat Jul 26 03:17:58 2014 -0700 @@ -303,6 +303,9 @@ grid <- fold: ghostState grid with: :acc ghost { vitality <- ghost value loc <- (ghost tail) value + dir <- (ghost tail) tail + nextloc <- 0 + move <- 0 if: vitality = 1 { //treat fright mode ghosts as a pellet for now acc <- grid: acc set: loc to: 2 @@ -310,14 +313,27 @@ if: vitality = 0 { //treat normal mode ghosts as a wall for now acc <- grid: acc set: loc to: 0 + while: { move < 4 } do: { + nextloc <- calcPos: move loc + if: (grid: acc inBounds?: nextloc) { + acc <- grid: acc set: nextloc to: 0 + } else: {} + move <- move + 1 + } } else: {} } acc } + //make sure my location is marked clear even if there is a ghost nearby + grid <- grid: grid set: myLoc to: 1 visited <- treeMap: grid :row { treeMap: row :el { 0 } } path <- advancer: [(makeContClos: grid myLoc [])] + if: (path isInteger?) { + print: 42 + path <- [0] + } else: {} #[0 (path value)] }