# HG changeset patch # User William Morgan # Date 1406502845 25200 # Node ID 2c790eabe3798f62b7ef6f643a1ec949851a4861 # Parent 70423511f49d7befc8de974f63849663bc5158ff fixed bug with lambdaman/lambdaMan typo in gameState. diff -r 70423511f49d -r 2c790eabe379 code/gameState.lm --- a/code/gameState.lm Sun Jul 27 14:50:50 2014 -0700 +++ b/code/gameState.lm Sun Jul 27 16:14:05 2014 -0700 @@ -43,6 +43,9 @@ win <- 0 pillCount <- 50 + isFood <- :tile { (2 <= tile) myAnd: (tile <= 4) } + getLambdamanChoice <- {0} + makeEventType <- :lagTick isMovement behavior{ print: 12 :curTick { @@ -58,20 +61,28 @@ addEvents <- [] #[addEvents gameState] } - isFood <- :tile { (2 <= tile) myAnd: (tile <= 4) } - getLambdaManChoice <- {0} - moveLambdaMan <- makeEventType: 127 1 :tick gameState { - move <- getLambdaManChoice: + +/* + moveLambdaman <- makeEventType: 127 1 :tick gameState { + addEvents <- [] + #[addEvents gameState] + } +*/ + moveLambdaman <- makeEventType: 127 1 :tick gameState { + print: 20 + move <- getLambdamanChoice: newPos <- (calcPos: move lambdamanPos) impending <- grid: mapGrid get: newPos + print: 21 if: (not: (impending = 0)) { lambdamanPos <- impending } else: { } + print: 22 if: (impending isFood) { - #[(moveLambdaMan: (tick + 10)) gameState] + #[(moveLambdaman: (tick + 10)) gameState] } else: { - #[(moveLambdaMan: tick) gameState] + #[(moveLambdaman: tick) gameState] } } @@ -92,6 +103,7 @@ */ executeEvents <- :tick isMove events gameState { + print: #[23 tick isMove events gameState] event <- 0 eventTick <- 0 eventIsMove <- 0 @@ -107,7 +119,7 @@ if: ( ( eventTick = tick ) myAnd: ( eventIsMove = isMove ) ) { eventLam <- ((event tail) tail) res <- eventLam: gameState - unexpired <- res value + unexpired <- (res value) | unexpired gameState <- res tail } else: { unexpired <- event | unexpired @@ -162,24 +174,25 @@ curMin } } + print: 4 :runUntil { res <- 0 tick <- 1 events <- [ endOfLives: 0 - //moveLambdaman: 0 + moveLambdaman: 0 ] print: 6 gameState <- #[0 0] while: {(tick < runUntil) myAnd: (not: (events empty?))} do: { - print: 7 - tick <- events nextTick print: 5 res <- executeTick: tick events gameState print: 13 events <- res value gameState <- res tail + print: 7 + tick <- events nextTick } } }