Diff
Not logged in

Differences From Artifact [dca756d0b000be21]:

To Artifact [7cfac19f78d8844c]:


61 61 const(Pos)[] tgt; 62 62 for(int y=1; y<=g.map.H; ++y) 63 63 for(int x=1; x<=g.map.W; ++x) 64 64 if(g.map[y,x]=='.') 65 65 if(g.map[y+1,x]=='*'||g.map[y+1,x-1]=='*'||g.map[y+1,x+1]=='*' 66 66 ||g.map[y,x+1]=='*'||g.map[y,x-1]=='*') 67 67 tgt ~= new Pos(y,x); 68 - cand ~= search(g, ro, tgt, death); 68 + cand ~= search(g, ro, tgt, death, true); 69 69 } 70 70 71 71 if(cand.empty) 72 72 cand ~= tuple('W',int.max); 73 73 sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ 74 74 if(c1[1] != c2[1]) 75 75 return c1[1] < c2[1]; ................................................................................ 106 106 if( cnt >= 3 && breath==1 ) { 107 107 forbidden_cell[ro.y][ro.x] = true; 108 108 } 109 109 110 110 return c; 111 111 } 112 112 113 - Tuple!(char,int)[] search(in Game g, in Pos s, in Pos[] gs, string death) 113 + Tuple!(char,int)[] search(in Game g, in Pos s, in Pos[] gs, string death, bool danger_ok=false) 114 114 { 115 115 bool danger(int y, int x) 116 116 { 117 + if(g.map[y,x] == ' ' || g.map[y,x] == 'R') 118 + return false; 117 119 if(g.map[y+1,x] == '*') 118 120 return true; 119 121 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')) 120 122 return true; 121 123 if(g.map[y+1,x+1]=='*' && (g.map[y,x+1]=='*') && (g.map[y+1,x]==' '||g.map[y+1,x]=='R')) 122 124 return true; 123 125 if(g.map[y,x-1]=='*' && (g.map[y-1,x-1]=='\\'||g.map[y-1,x-1]=='*') && (g.map[y-1,x]==' '||g.map[y-1,x]=='R')) ................................................................................ 222 224 } 223 225 } 224 226 } 225 227 q = q2; 226 228 } 227 229 return []; 228 230 } 229 - return tryA() ~ tryB() ~ tryC(); 231 + return (danger_ok ? [] : tryA()) ~ tryB() ~ tryC(); 230 232 } 231 233 }