@@ -52,8 +52,9 @@ const Pos ro = g.map.robot; const Pos[] la = g.map.lambdas(); const Pos[] ra = g.map.razors(); const Pos li = g.map.lift; + const Pos[] hi = g.map.objects('W'); Tuple!(char,int)[] cand; char c = 'W'; if( la.empty ) { @@ -60,8 +61,35 @@ cand = search(g, ro, [li], death); } else { cand ~= search(g, ro, la~ra, death); } + + // 'higesori' mode + if( !hi.empty && g.map.razor>0 ) { + int his = 0; + for(int dy=-1; dy<=+1; ++dy) + for(int dx=-1; dx<=+1; ++dx) + if(g.map[ro.y+dy,ro.x+dx] == 'W') + his++; + + if(his>=2 || his==hi.length) + cand = [tuple('S',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]=='.'||g.map[y,x]==' ') { + his = 0; + for(int dy=-1; dy<=+1; ++dy) + for(int dx=-1; dx<=+1; ++dx) + if(g.map[y+dy,x+dx] == 'W') + his++; + if(his>=2) + tgt ~= new Pos(y,x); + } + cand ~= search(g, ro, tgt, death, true); + } + } // 'dig' mode if(cand.empty) { const(Pos)[] tgt;