Check-in [9fd05a2326]
Not logged in
Overview
SHA1 Hash:9fd05a232645a121554789eb5ec0c38c9f2e3936
Date: 2012-07-16 16:24:55
User: kinaba
Comment:better integrated horo-push.
Timelines: family | ancestors | descendants | both | trunk
Diffs: redesign
Downloads: Tarball | ZIP archive
Other Links: files | file ages | manifest
Tags And Properties
Changes

Modified src/solver.d from [b158ce3255b33a97] to [a41fda48c5fe0806].

207 207 his++; 208 208 if(his>=2) 209 209 tgt ~= new Pos(y,x); 210 210 } 211 211 cand ~= search(g, ro, tgt, death, true); 212 212 } 213 213 } 214 + 215 + // 'horo-push' mode 216 + if(cand.empty) { 217 + Pos[] horo = g.map.objects('@'); 218 + Pos[] tgt; 219 + foreach(p; horo) 220 + if((g.map[p.y,p.x-1]==' '||g.map[p.y,p.x-1]=='R')&& 221 + (g.map[p.y,p.x+1]==' '||g.map[p.y,p.x+1]=='R') 222 + ||(g.map[p.y-1,p.x]==' '||g.map[p.y-1,p.x]=='R')) 223 + tgt ~= p; 224 + 225 + for(int y=1; y<=g.map.H; ++y) 226 + for(int x=1; x<=g.map.W; ++x) 227 + if(g.map[y,x]=='.') 228 + if(is_rocky(g.map[y+1,x])||is_rocky(g.map[y+1,x-1])||is_rocky(g.map[y+1,x+1]) 229 + ||is_rocky(g.map[y,x+1])||is_rocky(g.map[y,x-1])) 230 + tgt ~= new Pos(y,x); 231 + 232 + if(!tgt.empty) 233 + cand ~= search(g, ro, tgt, death, true); 234 + } 214 235 215 236 // 'dig' mode 216 237 if(cand.empty) { 217 - const(Pos)[] tgt; 238 + Pos[] tgt; 218 239 for(int y=1; y<=g.map.H; ++y) 219 240 for(int x=1; x<=g.map.W; ++x) 220 241 if(g.map[y,x]=='.') 221 242 if(is_rocky(g.map[y+1,x])||is_rocky(g.map[y+1,x-1])||is_rocky(g.map[y+1,x+1]) 222 243 ||is_rocky(g.map[y,x+1])||is_rocky(g.map[y,x-1])) 223 244 tgt ~= new Pos(y,x); 224 245 cand ~= search(g, ro, tgt, death, true); 225 246 } 226 247 227 - // 'horo-push' mode 228 - if(cand.empty) { 229 - Pos[] horo = g.map.objects('@'); 230 - if(!horo.empty) { 231 - cand ~= search(g, ro, horo, death, true); 232 - } 233 - } 234 - 235 248 if(cand.empty) { 236 249 choke_count++; 237 250 cand ~= tuple('W',int.max); 238 251 } 239 252 sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ 240 253 if(c1[1] != c2[1]) 241 254 return c1[1] < c2[1];