annotate code/ghost2.gq @ 73:91e7a30a9e27

Unsuccessful attempt at improving ghost performance with a wingman ghost
author Michael Pavone <pavone@retrodev.com>
date Mon, 28 Jul 2014 00:42:45 -0700
parents
children 10a75a37c0fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 up <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 right <- 1
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 down <- 2
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 left <- 3
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 myIdx <- (me: )
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 lastX <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 lastY <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 myX <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 myY <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 getDirX <- :dir startX {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 if: dir = right {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 startX <- startX + 1
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 if: dir = left {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 startX <- startX - 1
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 startX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 getDirY <- :dir startY {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 if: dir = up {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 startY <- startY - 1
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 if: dir = down {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 startY <- startY + 1
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 startY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 /*
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 opDir <- :dir {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 (dir + 2) and: 3
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 */
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 goTowardsX:Y <- :targetX targetY {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 myVit <- ghostStatus: myIdx
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
42 myDir <- direction
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
43
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
44
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
45 firstChoice <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46 secondChoice <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 if: myX > targetX {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49 //ghost is to the right of target
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50 if: myY > targetY {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
51 //ghost is below target
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52 if: (myX - targetX) > (myY - targetY) {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53 //target is more left than up
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
54 firstChoice <- left
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55 secondChoice <- up
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
56 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
57 firstChoice <- up
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58 secondChoice <- left
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
60 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
61 //ghost is above or directly to the right of target
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
62 if: (myX - targetX) > (targetY - myY) {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
63 //target is more left than down
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
64 firstChoice <- left
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
65 secondChoice <- down
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
66 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
67 //target is more down than left
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
68 firstChoice <- down
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
69 secondChoice <- left
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
70 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
71 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
72 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
73 //ghost is to the left of or directly above/below target
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
74 if: myY > targetY {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
75 //ghost is below target
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
76 if: (targetX - myX) > (myY - targetY) {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
77 //target is more right than up
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
78 firstChoice <- right
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
79 secondChoice <- up
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
80 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
81 firstChoice <- up
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
82 secondChoice <- right
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
83 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
84 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
85 //ghost is above or directly to the left of target
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
86 if: (targetX - myX) > (targetY - myY) {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
87 //target is more right than down
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
88 firstChoice <- right
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
89 secondChoice <- down
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
90 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
91 //target is more down than right
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
92 firstChoice <- down
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
93 secondChoice <- right
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
94 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
95 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
96 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
97 if: myVit = 1 {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
98 //currently in fright mode, try to run away
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
99 firstChoice <- (firstChoice + 2) and: 3 //opDir: firstChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
100 secondChoice <- (secondChoice + 2) and: 3 //opDir: secondChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
101 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
102
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
103
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
104
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
105 tmp <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
106 i <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
107 fail <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
108 while: { i < 3} do: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
109 targetX <- getDirX: firstChoice myX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
110 targetY <- getDirY: firstChoice myY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
111
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
112 if: (mapContentsAt: targetX targetY) - 1 > 4 {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
113 //first choice is a wall or ghost start pos
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
114 tmp <- firstChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
115 firstChoice <- secondChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
116 secondChoice <- (firstChoice + 2) and: 3 //opDir: firstChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
117 i <- i + 1
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
118 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
119 if: firstChoice = ( (myDir + 2) and: 3 /*opDir: myDir*/) {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
120 //first choice is backwards
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
121 tmp <- firstChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
122 firstChoice <- secondChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
123 secondChoice <- (firstChoice + 2) and: 3 //opDir: firstChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
124 i <- i + 1
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
125 } else: {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
126 i <- 3
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
127 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
128 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
129 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
130 direction!: firstChoice
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
131
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
132 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
133 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
134
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
135 //"wingman" - tries to surround lambda man
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
136 //position two cells ahead of his current position
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
137 main <- {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
138 lmX <- lambdamanPos:
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
139 lmY <- yCoord
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
140 myX <- ghostPos: myIdx
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
141 myY <- yCoord
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
142 diffX <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
143 diffY <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
144
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
145 if: notFirst? = 1 {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
146 diffX <- lmX - lastX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
147 diffY <- lmY - lastY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
148 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
149 lastX <- lmX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
150 lastY <- lmY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
151
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
152 distX <- myX - lmX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
153 if: distX < 0 {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
154 distX <- 0 - distX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
155 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
156 distY <- myY - lmY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
157 if: distY < 0 {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
158 distY <- 0 - distX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
159 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
160 dist <- distX + distY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
161 if: dist < 8 {
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
162 diffX <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
163 diffY <- 0
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
164 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
165
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
166 lmX <- (lmX + diffY) + diffY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
167 lmY <- (lmY + diffX) + diffX
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
168
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
169 goTowardsX: lmX Y: lmY
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
170
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
171 }
91e7a30a9e27 Unsuccessful attempt at improving ghost performance with a wingman ghost
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
172 }