changeset 53:2c790eabe379

fixed bug with lambdaman/lambdaMan typo in gameState.
author William Morgan <billjunk@mrgn.org>
date Sun, 27 Jul 2014 16:14:05 -0700
parents 70423511f49d
children 476cd9eba2be
files code/gameState.lm
diffstat 1 files changed, 23 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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
 			}
 		}
 	}