@@ -9,8 +9,9 @@ class Solver_1 { int wait_count = 0; + int choke_count = 0; Game g; this(const(Game) g) { @@ -71,10 +72,12 @@ tgt ~= new Pos(y,x); cand ~= search(g, ro, tgt, death, true); } - if(cand.empty) + if(cand.empty) { + choke_count++; 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]; @@ -88,15 +91,14 @@ break; } } - if(c=='W') { + if(c == 'W') wait_count++; - if(wait_count > g.map.H) - c = 'A'; - } else wait_count = 0; + if(choke_count >= g.map.H) + c = 'A'; bool[char] choice; foreach(t; cand) choice[t[0]] = true;