🤖 AI Summary
FoxtrotOnce released a MiniZinc-based constraint programming solver that models the puzzle game Railbound as a full constraint satisfaction problem. The repo encodes tracks, switches, gates, trains and timing into decision variables and searches for legal assignments that produce valid routes; 12 campaign levels are tracked, with levels 1–8 fully solved automatically and 9–12 still being modeled. The project is aimed at readability for people learning CP and is being integrated into a public website frontend; it includes a visualization frontend (viz.html), benchmark logs, and ready-to-run .dzn instances.
Technically, geometry and orientation for straights/curves/switches are finite-domain variables, and a discrete time horizon enforces movement and coupling via ordering constraints and capacity constraints that prevent simultaneous occupation of a segment. Switch behavior (deterministic, dynamic, exit-triggered) is encoded with auxiliary Booleans to represent state transitions; gates and activation tiles use timing constraints so gates are open precisely when needed; tunnels are modeled by equality constraints that teleport a train within the same timestep; semaphores impose a mandatory one-step wait plus mutual exclusion at three-way merges; stations, decoys and dual-target goals are all handled with indexed constraints and dwell/visit rules. The solver runs with MiniZinc + OR-Tools (minizinc --solver or-tools main.mzn data/...), with levels 1–7 typically under 1s and the large-grid level 8 taking up to ~1 minute on laptop hardware. Contributions, issues and PRs to expand the remaining levels or refine encodings are welcome.
Loading comments...
login to comment
loading comments...
no comments yet