Index: src/gui.d ================================================================== --- src/gui.d +++ src/gui.d @@ -19,11 +19,11 @@ void run(bool automate = false) { if(automate) { Timer t = new Timer; - t.interval = 100; + t.interval = 50; t.tick ~= (Timer sender, EventArgs ea){ fn(solver.single_step()); }; t.start(); this.closing ~= (Form f,CancelEventArgs c){t.stop();}; Index: src/solver.d ================================================================== --- src/solver.d +++ src/solver.d @@ -63,11 +63,11 @@ 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); + cand ~= search(g, ro, tgt, death, true); } if(cand.empty) cand ~= tuple('W',int.max); sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ @@ -108,14 +108,16 @@ } return c; } - Tuple!(char,int)[] search(in Game g, in Pos s, in Pos[] gs, string death) + Tuple!(char,int)[] search(in Game g, in Pos s, in Pos[] gs, string death, bool danger_ok=false) { bool danger(int y, int x) { + if(g.map[y,x] == ' ' || g.map[y,x] == 'R') + return false; if(g.map[y+1,x] == '*') return true; if(g.map[y+1,x-1]=='*' && (g.map[y,x-1]=='\\'||g.map[y,x-1]=='*') && (g.map[y+1,x]==' '||g.map[y+1,x]=='R')) return true; if(g.map[y+1,x+1]=='*' && (g.map[y,x+1]=='*') && (g.map[y+1,x]==' '||g.map[y+1,x]=='R')) @@ -224,8 +226,8 @@ } q = q2; } return []; } - return tryA() ~ tryB() ~ tryC(); + return (danger_ok ? [] : tryA()) ~ tryB() ~ tryC(); } }