Overview
SHA1 Hash: | 05e91f8e53e53f21501ade36dd33a8b9e5157e4e |
---|---|
Date: | 2012-07-14 11:13:47 |
User: | kinaba |
Comment: | add infra for clever command. |
Timelines: | family | ancestors | descendants | both | trunk |
Diffs: | redesign |
Downloads: | Tarball | ZIP archive |
Other Links: | files | file ages | manifest |
Tags And Properties
- branch=trunk inherited from [16f0b5784f]
- sym-trunk inherited from [16f0b5784f]
Changes
Modified test.d from [5ea3ddf4a0f6a860] to [4262c5e337ee629c].
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();