| 453 | } |
| 454 | |
| 455 | static int riskOfStuckConstructionAt(coord pos) { |
| 456 | auto risk = 0; |
| 457 | for (auto npos : neighbors | transform(around(pos))) { |
| 458 | if (!isSuitableAccess(npos)) { // original used walkable |
| 459 | ++risk; // one access blocked, increase danger |
| 460 | } else if (!plannedImpassibleAt(npos)) { |
| 461 | // walkable neighbour with no plan to build a wall, no danger |
| 462 | return -1; |
| 463 | } |
| 464 | } |
| 465 | return risk; |
| 466 | } |
| 467 | |
| 468 | |
| 469 |