Mercurial > repos > icfp2014
comparison code/ghost0.gq @ 69:8a0f1447c034
Implement plain if in gqc and use it in ghost0. This provides a small improvement in code size
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 27 Jul 2014 23:19:23 -0700 |
parents | f4f403c83e80 |
children |
comparison
equal
deleted
inserted
replaced
68:f4f403c83e80 | 69:8a0f1447c034 |
---|---|
8 if: dir = right { | 8 if: dir = right { |
9 startX <- startX + 1 | 9 startX <- startX + 1 |
10 } else: { | 10 } else: { |
11 if: dir = left { | 11 if: dir = left { |
12 startX <- startX - 1 | 12 startX <- startX - 1 |
13 } else: {} | 13 } |
14 } | 14 } |
15 startX | 15 startX |
16 } | 16 } |
17 | 17 |
18 getDirY <- :dir startY { | 18 getDirY <- :dir startY { |
19 if: dir = up { | 19 if: dir = up { |
20 startY <- startY - 1 | 20 startY <- startY - 1 |
21 } else: { | 21 } else: { |
22 if: dir = down { | 22 if: dir = down { |
23 startY <- startY + 1 | 23 startY <- startY + 1 |
24 } else: {} | 24 } |
25 } | 25 } |
26 startY | 26 startY |
27 } | 27 } |
28 | 28 |
29 opDir <- :dir { | 29 opDir <- :dir { |
97 } | 97 } |
98 if: myVit = 1 { | 98 if: myVit = 1 { |
99 //currently in fright mode, try to run away | 99 //currently in fright mode, try to run away |
100 firstChoice <- opDir: firstChoice | 100 firstChoice <- opDir: firstChoice |
101 secondChoice <- opDir: secondChoice | 101 secondChoice <- opDir: secondChoice |
102 } else: {} | 102 } |
103 | 103 |
104 | 104 |
105 | 105 |
106 tmp <- 0 | 106 tmp <- 0 |
107 i <- 0 | 107 i <- 0 |