. Boats climb a hillside through a flight of locks. Each lockage needs a keeper on the spot and sends a chamber of water downhill; nothing moves at night. Press ▶ to watch both days; new to locks? Read how a lock works.
Bars show waiting time of late boats by cause, weighted by priority. Every explanation is worked out from the simulated schedule: at each minute a boat waits, the engine checks the night, closures, the chamber, the pool level and every keeper.
Try a disruption: close a lock for a while or hold a boat back, then press Re-plan. The page re-solves in your browser with the same scheduler code as solve.js (a shorter search), then shows the new score and which boats got later or earlier, and why.
A canal cannot run uphill, so it is cut into level pools joined by locks. A lock is a chamber with gates at both ends. To go up, a boat enters the chamber while it is low, the gates close, and the keeper lets water in from the pool above until the chamber is level with it. To go down, the chamber is emptied into the pool below.
Filling a chamber takes its volume out of the pool above; emptying it pours that water into the pool below. So water only ever runs downhill. The only new water is a feeder stream into the summit pool. A pool may never drop below its minimum, so sometimes a boat must wait until water arrives from higher up. Pools that are already full spill over a weir into the pool below.
A boat going up needs the chamber low. If the last boat went up, the chamber is full, and someone has to empty it first: an empty turn. Boats going the opposite way share the work nicely; boats going the same way pay for a turn each time. Two narrowboats (or one barge) fit in a chamber together.
Nothing moves without a keeper at the lock for the whole lockage, and there are only a few keepers for many locks, so they walk the towpath between jobs. The canal is open 06:00 to 22:00 and some locks close for maintenance.
Each boat has a deadline and a priority (1 to 3). Weighted lateness is the sum of priority × minutes late: lower is better. Ties are broken by water drawn (total volume taken by up-lockages). The schedule shown was produced by solve.js and is checked here, in the page, by the same rules engine as validate.js.
The hillside climbs from the river (left) to the summit (right). Water depth in each pool is drawn between its minimum (dashed line) and maximum; a pool turns amber when it holds too little for its next lockage. Figures on the towpath are keepers. Shaded night hides the canal from 22:00 to 06:00, and a red barrier marks a closed lock. Click a boat to follow it.