Index: src/solver.d ================================================================== --- src/solver.d +++ src/solver.d @@ -55,11 +55,23 @@ if( la.empty ) { cand = search(g, ro, [li], death); } else { cand ~= search(g, ro, la, death); } - cand ~= tuple('W',int.max); + 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]=='.') + if(g.map[y+1,x]=='*'||g.map[y+1,x-1]=='*'||g.map[y+1,x+1]=='*' + ||g.map[y,x+1]=='*'||g.map[y,x-1]=='*') + tgt ~= new Pos(y,x); + cand ~= search(g, ro, tgt, death); + } + + if(cand.empty) + cand ~= tuple('W',int.max); sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ if(c1[1] != c2[1]) return c1[1] < c2[1]; return c1[0] < c2[0]; })(cand);