5 · Movement rules, as pictures
Every rule from chapter VII of the subject, each with a tiny calendar. Chips are drones; a dashed chip is a drone in flight on a connection.
1A zone that empties is free in the same turn
Capacity is checked at the end of the turn, after everyone has moved. So D2 may enter waypoint1 in the very turn D1 leaves it. A single-file column advances one step per turn (map easy/01, capacity 1 everywhere):
| zone | turn 1 | turn 2 | turn 3 | turn 4 |
|---|---|---|---|---|
| waypoint1 | D1 | D2 | · | · |
| waypoint2 | · | D1 | D2 | · |
| goal | · | · | D1 | D1D2 |
Without this rule D2 would have to wait an extra turn each step. The optimum for this map is 4 turns, and you only get it with this rule.
2Entering a restricted zone takes 2 turns
On the first turn the drone is on the connection; on the second it lands. The subject's own example: connection s-r with capacity 1 into restricted zone r:
| where | turn 1 | turn 2 | turn 3 |
|---|---|---|---|
| connection s-r (1) | D1 | D2 | · |
| zone r (restricted) | · | D1 | D2 |
D1-s-r ← in flight: print the connection name
D1-r D2-s-r ← D1 lands, and the connection is free again this turn, so D2 starts
D2-r
r has room at turn+2, not turn+1.
3No waiting on a connection
D1-s-r
D1-rD1-s-r
← D1 missing: still flying?
D1-rWaiting is only allowed in a zone. A drone in flight appears on the very next line, landed.
4Connection capacity counts drones starting to cross
max_link_capacity=n limits how many drones begin crossing that connection in one turn, counting both directions together.
D1-junction D2-junctionTwo drones cross start-junction together.
D1-junction D2-junctionTwo on a capacity-1 connection in one turn.
5The special zones
| Zone | Rule | In your code |
|---|---|---|
| start_hub | All drones begin here. No capacity limit, even if the map gives max_drones. | capacity() returns "unlimited" |
| end_hub | No limit. A drone that arrives is delivered and disappears from the output. | Stop tracking it |
| blocked | Never entered, never passed through. | Skip it in BFS / search |
| restricted | Costs 2 turns to enter (rule 2). | move_cost == 2 |
| priority | Costs 1 turn, "should be preferred". | Tie-breaker only: prefer it when two routes arrive at the same turn. Never take a slower route just to use it. |
6The output format
D1-roof1 D2-corridorA ← one line per turn, moves separated by spaces
D1-roof2 D2-tunnelB ← drones that don't move are left out
D1-goal D2-goal ← after this, D1 and D2 never appear again
D<id>-<zone>for a normal move. Ids start at 1.D<id>-<a>-<b>for a drone in flight toward a restricted zone (zone names never contain-, so this is unambiguous).- The simulation ends when every drone is delivered. Number of lines = number of turns.
7Simultaneous means simultaneous
All moves in a turn are decided from the state at the start of the turn. There is no "D1 moved first, so now D2 can…" within a turn, except for rule 1 (space freed by a drone leaving). In calendar terms: you check every cell at the end of the turn, all at once.
Cheat sheet
| Question | Answer |
|---|---|
| When is capacity checked? | End of turn, after all moves. |
| Can a drone enter a zone another drone leaves this turn? | Yes. |
| How many turns into a restricted zone? | 2, with the connection printed on the first. |
| Can a drone hover on a connection? | No. |
| What does link capacity count? | Drones starting to cross it in that turn, both directions. |
| Start/end capacity? | Unlimited, always. |
| Unreachable goal? | Not a parse error: detect it and report it clearly. |
| Does the turn count decide pass/fail? | No. Correctness does. Turns only add bonus points (within 25% / exact optimum). |