Diff
Not logged in

Differences From Artifact [1e2f760afef7fe9f]:

To Artifact [b158ce3255b33a97]:


219 219 for(int x=1; x<=g.map.W; ++x) 220 220 if(g.map[y,x]=='.') 221 221 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 222 ||is_rocky(g.map[y,x+1])||is_rocky(g.map[y,x-1])) 223 223 tgt ~= new Pos(y,x); 224 224 cand ~= search(g, ro, tgt, death, true); 225 225 } 226 + 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 + } 226 234 227 235 if(cand.empty) { 228 236 choke_count++; 229 237 cand ~= tuple('W',int.max); 230 238 } 231 239 sort!((Tuple!(char,int) c1, Tuple!(char,int) c2){ 232 240 if(c1[1] != c2[1]) ................................................................................ 294 302 Tuple!(char,int)[] tryA() { 295 303 const(Pos)[] q; 296 304 foreach(p; gs) 297 305 if(!danger(p.y,p.x)) 298 306 q ~= p; 299 307 bool[][] v = new bool[][](g.map.H+2, g.map.W+2); 300 308 foreach(p; q) v[p.y][p.x]=true; 309 + bool first_step = true; 301 310 for(int step=1; q.length; ++step) { 302 311 Pos[] q2; 303 312 foreach(p; q) { 304 313 int[] yyy=[p.y-1,p.y,p.y,p.y+1]; 305 314 int[] xxx=[p.x,p.x-1,p.x+1,p.x]; 306 315 string sss="URLD"; 307 - for(int i=0; i<yyy.length; ++i) { 316 + for(int i=0; i<yyy.length; ++i) if(!first_step || g.map[p]!='@' || sss[i]=='L' || sss[i]=='R') { 308 317 int y = yyy[i]; 309 318 int x = xxx[i]; 310 319 if('1'<=g.map[y,x]&&g.map[y,x]<='9') { 311 320 foreach(ppp; g.tr.source_pos(g.map[y,x])) { 312 321 yyy ~= ppp.y; 313 322 xxx ~= ppp.x; 314 323 } ................................................................................ 324 333 if(danger(y,x)) 325 334 continue; 326 335 q2 ~= new Pos(y,x); 327 336 v[y][x]=true; 328 337 } 329 338 } 330 339 } 340 + first_step = false; 331 341 q = q2; 332 342 } 333 343 return []; 334 344 } 335 345 336 346 // any empty space is my ground 337 347 Tuple!(char,int)[] tryB() { 338 348 const(Pos)[] q; 339 349 foreach(p; gs) q ~= p; 340 350 bool[][] v = new bool[][](g.map.H+2, g.map.W+2); 341 351 foreach(p; q) v[p.y][p.x]=true; 352 + bool first_step = true; 342 353 for(int step=8; q.length; ++step) { 343 354 Pos[] q2; 344 355 foreach(p; q) { 345 356 int[] yyy=[p.y-1,p.y,p.y,p.y+1]; 346 357 int[] xxx=[p.x,p.x-1,p.x+1,p.x]; 347 358 string sss="URLD"; 348 - for(int i=0; i<yyy.length; ++i) { 359 + for(int i=0; i<yyy.length; ++i) if(!first_step || g.map[p]!='@' || sss[i]=='L' || sss[i]=='R') { 349 360 int y = yyy[i]; 350 361 int x = xxx[i]; 351 362 if('1'<=g.map[y,x]&&g.map[y,x]<='9') { 352 363 foreach(ppp; g.tr.source_pos(g.map[y,x])) { 353 364 yyy ~= ppp.y; 354 365 xxx ~= ppp.x; 355 366 } ................................................................................ 363 374 } else if(forbidden_cell[y][x]){ 364 375 } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||g.map[y,x]=='!'||i>=4) { 365 376 q2 ~= new Pos(y,x); 366 377 v[y][x]=true; 367 378 } 368 379 } 369 380 } 381 + first_step = false; 370 382 q = q2; 371 383 } 372 384 return []; 373 385 } 374 386 375 387 // push rocks! 376 388 Tuple!(char,int)[] tryC() { 377 389 const(Pos)[] q; 378 390 foreach(p; gs) q ~= p; 379 391 bool[][] v = new bool[][](g.map.H+2, g.map.W+2); 380 392 foreach(p; q) v[p.y][p.x]=true; 393 + bool first_step = true; 381 394 for(int step=20; q.length; ++step) { 382 395 Pos[] q2; 383 396 foreach(p; q) { 384 397 int[] yyy=[p.y-1,p.y,p.y,p.y+1]; 385 398 int[] xxx=[p.x,p.x-1,p.x+1,p.x]; 386 399 string sss="URLD"; 387 - for(int i=0; i<yyy.length; ++i) { 400 + for(int i=0; i<yyy.length; ++i) if(!first_step || g.map[p]!='@' || sss[i]=='L' || sss[i]=='R') { 388 401 int y = yyy[i]; 389 402 int x = xxx[i]; 390 403 if(is_rocky(g.map[p])) { 391 404 if(i>=4)continue; 392 405 if(y!=p.y)continue; 393 406 if(g.map[y,p.x+(p.x-x)]!=' '&&g.map[y,p.x+(p.x-x)]!='R')continue; 394 407 } ................................................................................ 407 420 } else if(forbidden_cell[y][x]){ 408 421 } else if(g.map[y,x]==' '||g.map[y,x]=='\\'||g.map[y,x]=='.'||is_rocky(g.map[y,x])||g.map[y,x]=='!'||i>=4) { 409 422 q2 ~= new Pos(y,x); 410 423 v[y][x]=true; 411 424 } 412 425 } 413 426 } 427 + first_step = false; 414 428 q = q2; 415 429 } 416 430 return []; 417 431 } 418 432 return (danger_ok ? [] : tryA()) ~ tryB() ~ tryC(); 419 433 } 420 434 }