Mercurial > repos > icfp2014
comparison code/gameState.lm @ 47:115695e42307
gamestate incremental progress, but does not compile at the moment. sleep time.
author | William Morgan <billjunk@mrgn.org> |
---|---|
date | Sun, 27 Jul 2014 02:33:07 -0700 |
parents | d631e68a45d5 |
children | 57a4bddadd46 |
comparison
equal
deleted
inserted
replaced
46:d631e68a45d5 | 47:115695e42307 |
---|---|
34 (a + b) = 2 | 34 (a + b) = 2 |
35 } | 35 } |
36 | 36 |
37 makeTicker <- :mapWidth mapHeight { | 37 makeTicker <- :mapWidth mapHeight { |
38 lives <- 3 | 38 lives <- 3 |
39 lambdamanPos <- #[5 5] | |
39 win <- 0 | 40 win <- 0 |
40 pillCount <- 50 | 41 pillCount <- 50 |
41 | 42 |
42 makeEventType <- :lagTick isMovement behavior{ | 43 makeEventType <- :lagTick isMovement behavior{ |
43 print: 12 | 44 print: 12 |
53 777 print | 54 777 print |
54 addEvents <- [] | 55 addEvents <- [] |
55 #[addEvents gameState] | 56 #[addEvents gameState] |
56 } | 57 } |
57 | 58 |
59 isFood <- :tile {(2 <= tile) and (tile <= 4)} | |
60 getLambdaManChoice <- :{0} | |
61 moveLambdaMan <- makeEventType: 127 1 :tick gameState { | |
62 move <- getLambdaManChoice: | |
63 newPos <- (calcPos: move lambdamanPos) | |
64 impending <- grid: grid get: newPos | |
65 if: (not: (impending = 0)) { | |
66 lambdamanPos <- impending | |
67 } else { } | |
68 | |
69 if: (impending isFood) { | |
70 #[(moveLambdaMan: (tick + 10)) gameState] | |
71 } else { | |
72 #[(moveLambdaMan: tick) gameState] | |
73 } | |
74 } | |
75 | |
58 /* | 76 /* |
59 fruitStateEvent | 77 fruit <- 0 |
60 fruit1Appears <- makeEventType: (127 * 200) 0 :gameState { | 78 fruit1Appears <- makeEventType: (127 * 200) 0 :gameState { |
61 // set fruit state to on | 79 fruit <- 80 |
80 #[fruit1Expires gameState] | |
62 } | 81 } |
63 fruit2Appears <- (127 * 400) | 82 fruit2Appears <- (127 * 400) 0 |
64 fruit1Expires <- (127 * 280) | 83 fruit1Expires <- (127 * 280) 0 |
65 fruit2Expires <- (127 * 280) | 84 fruit2Expires <- (127 * 480) 0 |
66 | 85 moveGhost0 <- 1 //(ghostType, ghostId)!? |
67 getLambdaManChoice <- :{0} | 86 moveGhost1 <- 1 //(ghostType, ghostId)!? |
68 moveLambdaMan <- makeEventType: 127 0 : tick { | 87 moveGhost2 <- 1 //(ghostType, ghostId)!? |
69 move <- getLambdaManChoice: | 88 moveGhost3 <- 1 //(ghostType, ghostId)!? |
70 if: move | 89 frightModeDeactivate <- (127 * 20) 0 |
71 } | |
72 (eating, lamdamanId) | |
73 moveGhost <- (ghostType, ghostId) | |
74 frightModeDeactivate <- (127 * 20) | |
75 */ | 90 */ |
76 | 91 |
77 executeEvents <- :tick isMove events gameState { | 92 executeEvents <- :tick isMove events gameState { |
78 event <- 0 | 93 event <- 0 |
79 eventTick <- 0 | 94 eventTick <- 0 |