changeset 35:8c26981aae8c

Last fixes for lightning round version of dotScanner.lm
author Michael Pavone <pavone@retrodev.com>
date Sat, 26 Jul 2014 03:17:58 -0700
parents 968705fcb4c6
children c0b3922646d8
files code/dotScanner.lm
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)]
 	}