Index: src/solver.d ================================================================== --- src/solver.d +++ src/solver.d @@ -7,11 +7,11 @@ char single_step() { return 'W'; } } class Solver_1 { - int g_wc = 0; + int wait_count = 0; Game g; this(const(Game) g) { this.g = g.clone(); @@ -63,18 +63,27 @@ if(c1[1] != c2[1]) 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(live)==0) { + c=live; + break; + } + } if(c=='W') { - g_wc++; - if(g_wc > 10) + wait_count++; + if(wait_count > g.map.H) c = 'A'; } else - g_wc = 0; + wait_count = 0; + bool[char] choice; foreach(t; cand) choice[t[0]] = true; log ~= tuple(ro.clone(), cast(int)choice.length); if(log.length > 5)