Differences From Artifact [5ea3ddf4a0f6a860]:
- File
test.d
- 2012-07-14 02:04:49 - part of checkin [7693c375f5] on branch trunk - Air indicator. (user: kinaba) [annotate]
To Artifact [4262c5e337ee629c]:
- File
test.d
- 2012-07-14 02:13:47 - part of checkin [05e91f8e53] on branch trunk - add infra for clever command. (user: kinaba) [annotate]
168 168 if(underwater > water_proof)
169 169 dead = true;
170 170 }
171 171 if(!wa)
172 172 underwater = 0;
173 173 }
174 174 }
175 +
176 + int clever()
177 + {
178 + if(dead)
179 + return 0;
180 + int sy,sx;
181 + int[] ly,lx;
182 + int oy,ox;
183 + for(int y=0; y<H; ++y)
184 + for(int x=0; x<W; ++x)
185 + if(data[y][x]=='R')
186 + sy=y, sx=x;
187 + else if(data[y][x]=='\\')
188 + ly~=y, lx~=x;
189 + else if(data[y][x]=='O')
190 + oy=y, ox=x;
191 + if(ly.length==0)
192 + return goal(sy,sx,oy,ox);
193 + return wait();
194 + }
195 + int goal(int sy, int sx, int oy, int ox)
196 + {
197 + }
175 198 }
176 199
177 200 class MyForm : Form
178 201 {
179 202 Map m;
180 203 int score;
181 204
................................................................................
254 277 stdout.flush();
255 278 break;
256 279 case Keys.A:
257 280 score += m.abort();
258 281 write("A");
259 282 stdout.flush();
260 283 break;
284 + case Keys.G:
285 + score += m.clever();
286 + write("_");
287 + stdout.flush();
288 + break;
261 289 default:
262 290 break;
263 291 }
264 292 if(m.cleared) {
265 293 writeln();
266 294 writeln("Score: ", score);
267 295 Application.exit();