Differences From Artifact [a41fda48c5fe0806]:
- File
src/solver.d
- 2012-07-16 07:24:55 - part of checkin [9fd05a2326] on branch trunk - better integrated horo-push. (user: kinaba) [annotate]
To Artifact [accda2201a6a857e]:
- File
src/solver.d
- 2012-07-16 08:06:06 - part of checkin [3893826f55] on branch trunk - dangerness loosened. (user: kinaba) [annotate]
288 } 288 }
289 289
290 return c; 290 return c;
291 } 291 }
292 292
293 Tuple!(char,int)[] search(in Game g, in Pos s, in Pos[] gs, string death 293 Tuple!(char,int)[] search(in Game g, in Pos s, in Pos[] gs, string death
294 { 294 {
> 295 bool very_danger(int y, int x)
> 296 {
> 297 if(g.map[y,x] == ' ' || g.map[y,x] == 'R')
> 298 return false;
> 299 if(is_rocky(g.map[y+1,x]))
> 300 return true;
> 301 return false;
> 302 }
295 bool danger(int y, int x) 303 bool danger(int y, int x)
296 { 304 {
297 if(g.map[y,x] == ' ' || g.map[y,x] == 'R') 305 if(g.map[y,x] == ' ' || g.map[y,x] == 'R')
298 return false; 306 return false;
299 if(is_rocky(g.map[y+1,x])) 307 if(is_rocky(g.map[y+1,x]))
300 return true; 308 return true;
301 if(is_rocky(g.map[y+1,x-1]) && (g.map[y,x-1]=='\\'||is_r 309 if(is_rocky(g.map[y+1,x-1]) && (g.map[y,x-1]=='\\'||is_r
................................................................................................................................................................................
311 return false; 319 return false;
312 } 320 }
313 321
314 // avoid directly below '*' 322 // avoid directly below '*'
315 Tuple!(char,int)[] tryA() { 323 Tuple!(char,int)[] tryA() {
316 const(Pos)[] q; 324 const(Pos)[] q;
317 foreach(p; gs) 325 foreach(p; gs)
318 if(!danger(p.y,p.x)) | 326 if(!very_danger(p.y,p.x))
319 q ~= p; 327 q ~= p;
320 bool[][] v = new bool[][](g.map.H+2, g.map.W+2); 328 bool[][] v = new bool[][](g.map.H+2, g.map.W+2);
321 foreach(p; q) v[p.y][p.x]=true; 329 foreach(p; q) v[p.y][p.x]=true;
322 bool first_step = true; 330 bool first_step = true;
323 for(int step=1; q.length; ++step) { 331 for(int step=1; q.length; ++step) {
324 Pos[] q2; 332 Pos[] q2;
325 foreach(p; q) { 333 foreach(p; q) {