Differences From Artifact [b38729b48307e77e]:
- File
src/solver.d
- 2012-07-15 06:15:47 - part of checkin [f6c126aeeb] on branch trunk - better flushed check. (user: kinaba) [annotate]
To Artifact [dde2fe1d85562c17]:
- File
src/solver.d
- 2012-07-15 06:42:27 - part of checkin [0d078369c8] on branch trunk - score update & tweaked to solve contest2 (user: kinaba) [annotate]
335 335 {
336 336 int bp = max(0, (cast(int)plan.length)-10);
337 337 Game g = ini.clone();
338 338 for(int i=0; i<bp; ++i) g.command(plan[i]);
339 339
340 340 Tuple!(string,long) cand = tuple(plan, unmod);
341 341 for(int i=bp; i<plan.length; ++i) {
342 - foreach(char c; "UDLR")
343 - if(c != plan[i]) {
342 + foreach(string c; ["U","D","L","R","UD","DU","LR","RL"])
343 + if(c[0] != plan[i]) {
344 344 Tuple!(string,long) zz = try_plan(c, g);
345 345 if(cand[1]<zz[1])
346 346 cand = tuple(plan[0..i]~c~zz[0], zz[1]);
347 347 }
348 348 g.command(plan[i]);
349 349 }
350 350 plan = cand[0];
351 351 }
352 352
353 - Tuple!(string,long) try_plan(char c, in Game g)
353 + Tuple!(string,long) try_plan(string c, in Game g)
354 354 {
355 355 Game gg = g.clone();
356 - gg.command(c);
356 + foreach(cc;c)gg.command(cc);
357 357 Tuple!(Solver, string) x = run_sub_solver(gg);
358 358 return tuple(x[1], x[0].g.score);
359 359 }
360 360
361 361 char single_step() {
362 362 if(plan.empty)
363 363 return 'A';