Diff
Not logged in

Differences From Artifact [57f6f73657cc3655]:

To Artifact [393baf841678f948]:


301 301 return (danger_ok ? [] : tryA()) ~ tryB() ~ tryC(); 302 302 } 303 303 } 304 304 305 305 class Solver_2(Solver) 306 306 { 307 307 string plan; 308 + bool plan_broken = true; 308 309 309 310 Game g; 310 311 this(in Game g) 311 312 { 312 313 this.g = g.clone(); 313 314 make_plan(g); 314 315 } ................................................................................ 325 326 } 326 327 while(log.length>0 && log[$-1]=='W') 327 328 log.length--; 328 329 return tuple(s, log); 329 330 } 330 331 331 332 void make_plan(in Game g) { 333 + plan_broken = false; 332 334 Tuple!(Solver,string) x = run_sub_solver(g); 333 335 plan = x[1]; 334 336 if(x[0].g.cleared) 335 337 return; 336 338 modify_plan(g, x[0].g.score); 337 339 } 338 340 ................................................................................ 360 362 Game gg = g.clone(); 361 363 foreach(cc;c)gg.command(cc); 362 364 Tuple!(Solver, string) x = run_sub_solver(gg); 363 365 return tuple(x[1], x[0].g.score); 364 366 } 365 367 366 368 char single_step() { 369 + if(plan_broken) 370 + make_plan(g); 367 371 if(plan.empty) 368 372 return 'A'; 369 373 char c = plan[0]; 370 374 plan = plan[1..$]; 371 375 g.command(c); 372 376 return c; 373 377 } 374 378 375 379 void force(char c) { 376 380 g.command(c); 377 - make_plan(g); 381 + if(plan.length==0 || plan[0]!=c) { 382 + plan = ""; 383 + plan_broken = true; 384 + } 385 + else 386 + plan = plan[1..$]; 378 387 } 379 388 } 380 389 381 390 alias Solver_2!(Solver_1) MainSolver; 382 391 //alias Solver_1 MainSolver;