# HG changeset patch # User Michael Pavone # Date 1406538730 25200 # Node ID 6df7f6372d29bb0c75a1c431fc55944cf528c94c # Parent 10a75a37c0fabfb7da4bb82f97cc853bec7fa833 Small tweak to dotScanner lambda man AI to ignore power pellets when it would be wasteful to eat them diff -r 10a75a37c0fa -r 6df7f6372d29 code/dotScanner.lm --- a/code/dotScanner.lm Mon Jul 28 01:03:11 2014 -0700 +++ b/code/dotScanner.lm Mon Jul 28 02:12:10 2014 -0700 @@ -33,6 +33,7 @@ ] from: (module: "grid.lm") visited <- 0 + badGhostCount <- 0 advancer <- :continuations { notdone <- 1 @@ -74,6 +75,13 @@ if: (grid: visited get: myLoc) { } else: { atpos <- grid: grid get: myLoc + if: badGhostCount > 0 { + } else: { + //treat power pellets as empty space when there are no ghosts in normal mode + if: (atpos = 3) { + atpos <- 1 + } else: {} + } if: (atpos = 2) + (atpos = 3) + (atpos = 4) { //pellet, power pellet, fruit ret <- #[1 (reverse: path)] @@ -115,6 +123,7 @@ } makeTree: row }) + badGhostCount <- 0 grid <- fold: ghostState grid with: :acc ghost { vitality <- ghost value loc <- (ghost tail) value @@ -126,6 +135,7 @@ acc <- grid: acc set: loc to: 2 } else: { if: vitality = 0 { + badGhostCount <- badGhostCount + 1 //treat normal mode ghosts as a wall for now acc <- grid: acc set: loc to: 0 while: { move < 4 } do: {