Mercurial > repos > icfp2014
comparison code/gameState.lm @ 64:8f6ade456edf
bugfixes to runtime errors of gameState.lm
author | William Morgan <billjunk@mrgn.org> |
---|---|
date | Mon, 28 Jul 2014 03:14:50 -0700 |
parents | c17380c8bac3 |
children |
comparison
equal
deleted
inserted
replaced
63:428c1daefca9 | 64:8f6ade456edf |
---|---|
41 poorMod <- :input mod { | 41 poorMod <- :input mod { |
42 ret <- input | 42 ret <- input |
43 if: input >= mod { | 43 if: input >= mod { |
44 ret <- input - mod | 44 ret <- input - mod |
45 } else: { | 45 } else: { |
46 ret input | 46 ret <- input |
47 } | 47 } |
48 ret | 48 ret |
49 } | 49 } |
50 | 50 |
51 tupGet <- :cell idx size { | 51 tupGet <- :cell idx size { |
75 dirDown <- 2 | 75 dirDown <- 2 |
76 dirLeft <- 3 | 76 dirLeft <- 3 |
77 dirFlipped <- :dir {(dir + 2) poorMod: 4} | 77 dirFlipped <- :dir {(dir + 2) poorMod: 4} |
78 | 78 |
79 makeTicker <- :mapGrid :ghosts{ | 79 makeTicker <- :mapGrid :ghosts{ |
80 print: #[2 ghosts] | |
80 lives <- 3 | 81 lives <- 3 |
81 lambdamanStartPos <- #[5 5] // TODO grab during parse or write {grid: mapGrid find: tileLm} | 82 lambdamanStartPos <- #[5 5] // TODO grab during parse or write {grid: mapGrid find: tileLm} |
82 lambdamanStartDir <- dirDown | 83 lambdamanStartDir <- dirDown |
83 lambdamanPos <- lambdamanStartPos | 84 lambdamanPos <- lambdamanStartPos |
84 lambdamanDir <- lambdamanStartDir | 85 lambdamanDir <- lambdamanStartDir |
86 pillCount <- 50 // TODO count pills during parse | 87 pillCount <- 50 // TODO count pills during parse |
87 | 88 |
88 isFood <- :tile { (2 <= tile) myAnd: (tile <= 4) } | 89 isFood <- :tile { (2 <= tile) myAnd: (tile <= 4) } |
89 getLambdamanChoice <- {0} // TODO ai hookups | 90 getLambdamanChoice <- {0} // TODO ai hookups |
90 | 91 |
92 print: 30 | |
91 ghostPopulation <- ghosts value | 93 ghostPopulation <- ghosts value |
92 ghostChoosers <- #[{0} {0} {0} {0}] // TODO ai hookups | 94 ghostChoosers <- #[{0} {0} {0} {0}] // TODO ai hookups |
93 ghostChoice <- :ghostIdx{tupGet: ghostChoosers ghostIdx 4} | 95 ghostChoice <- :ghostIdx{tupGet: ghostChoosers ghostIdx 4} |
94 ghostModeStandard <- 0 | 96 ghostModeStandard <- 0 |
95 ghostModeFright <- 1 | 97 ghostModeFright <- 1 |
274 ghostIdx <- 0 | 276 ghostIdx <- 0 |
275 ghostType <- 0 | 277 ghostType <- 0 |
276 ghostTick <- 0 | 278 ghostTick <- 0 |
277 while: {ghostIdx < ghostPopulation} do: { | 279 while: {ghostIdx < ghostPopulation} do: { |
278 ghostTick <- ghostGetLag: ghostType ghostModeStandard | 280 ghostTick <- ghostGetLag: ghostType ghostModeStandard |
281 print: 5 | |
279 events <- (moveGhost: 0 ghostIdx ghostType ghostTick) | events | 282 events <- (moveGhost: 0 ghostIdx ghostType ghostTick) | events |
280 ghostIdx <- ghostIdx + 1 | 283 ghostIdx <- ghostIdx + 1 |
281 ghostType <- (ghostType + 1) poorMod: 4 | 284 ghostType <- (ghostType + 1) poorMod: 4 |
282 } | 285 } |
283 print: 5 | |
284 while: {(tick < runUntil) myAnd: (not: (events empty?))} do: { | 286 while: {(tick < runUntil) myAnd: (not: (events empty?))} do: { |
285 print: 6 | 287 print: 6 |
286 events <- executeTick: tick events | 288 events <- executeTick: tick events |
287 print: 7 | 289 print: 7 |
288 tick <- events nextTick | 290 tick <- events nextTick |
296 makeTree: row | 298 makeTree: row |
297 }) | 299 }) |
298 | 300 |
299 world | 301 world |
300 | 302 |
301 ticker <- makeTicker: grid | 303 ghostsList <- ((world tail) tail) value |
302 print: 2 | 304 ghosts <- makeTree: ghostsList |
305 ticker <- makeTicker: grid ghosts | |
306 print: 3 | |
303 ticker: 1000 | 307 ticker: 1000 |
304 print: 3 | |
305 | 308 |
306 #[0 0] | 309 #[0 0] |
307 } | 310 } |
308 | 311 |
309 /* | |
310 main <- :initWorld ghostCode{ | 312 main <- :initWorld ghostCode{ |
311 #[0 step] | 313 #[0 step] |
312 } | 314 } |
313 */ | 315 /* |
314 main <- { | 316 main <- { |
315 print: (step: 0 #[ | 317 print: (step: 0 #[ |
316 //grid | 318 //grid |
317 [ | 319 [ |
318 [0 0 0 0] | 320 [0 0 0 0] |
326 [] | 328 [] |
327 //fruit state | 329 //fruit state |
328 0 | 330 0 |
329 ]) | 331 ]) |
330 } | 332 } |
333 */ | |
331 } | 334 } |
332 | 335 |