Index: src/solver.d ================================================================== --- src/solver.d +++ src/solver.d @@ -35,10 +35,12 @@ gg.command(c); if( !gg.cleared && gg.dead ) death ~= c; else if( gg.map.robot != g.map.robot ) choice++; + else if( c != 'W' ) // meaningless move + death ~= c; } return tuple(death, choice); } Tuple!(Pos, int)[] log; @@ -55,10 +57,12 @@ if( la.empty ) { cand = search(g, ro, [li], death); } else { cand ~= search(g, ro, la, death); } + + // 'dig' mode if(cand.empty) { const(Pos)[] tgt; for(int y=1; y<=g.map.H; ++y) for(int x=1; x<=g.map.W; ++x) if(g.map[y,x]=='.') @@ -75,12 +79,12 @@ return c1[1] < c2[1]; return c1[0] < c2[0]; })(cand); c = cand[0][0]; - if(death.count(c)) { - foreach(char live; "UDLRWA") + if(death.count(c) || wait_count>=2) { + foreach(char live; "UDLRW") if(death.count(live)==0) { c=live; break; } }