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 if(underwater > water_proof) 168 if(underwater > water_proof)
169 dead = true; 169 dead = true;
170 } 170 }
171 if(!wa) 171 if(!wa)
172 underwater = 0; 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 class MyForm : Form 200 class MyForm : Form
178 { 201 {
179 Map m; 202 Map m;
180 int score; 203 int score;
181 204
................................................................................................................................................................................
254 stdout.flush(); 277 stdout.flush();
255 break; 278 break;
256 case Keys.A: 279 case Keys.A:
257 score += m.abort(); 280 score += m.abort();
258 write("A"); 281 write("A");
259 stdout.flush(); 282 stdout.flush();
260 break; 283 break;
> 284 case Keys.G:
> 285 score += m.clever();
> 286 write("_");
> 287 stdout.flush();
> 288 break;
261 default: 289 default:
262 break; 290 break;
263 } 291 }
264 if(m.cleared) { 292 if(m.cleared) {
265 writeln(); 293 writeln();
266 writeln("Score: ", score); 294 writeln("Score: ", score);
267 Application.exit(); 295 Application.exit();