THIS REPO IS WORK IN PROGRESS, THE CODE IS NOT FUNCTIONAL YET T^T
Railbound Puzzle Solver is a Python-based tool designed to solve puzzles from the game Railbound, a comfy, track-bending puzzle game developed by Afterburn. This solver features a graphical editor for recreating Railbound puzzles and an automated solver that can find solutions to complex track layouts.
Railbound is a puzzle game about a pair of dogs on a train journey around the world. Players connect and sever railways across different landscapes to help everyone reach their homes. The game features:
- 240+ puzzles across different parts of the world
- Various train-inspired mechanics including tunnels and semaphores
- Comic-book-esque visuals and a relaxing original soundtrack
For more information about the original game, visit the official Railbound website.
- Puzzle Editor: A graphical user interface for recreating Railbound puzzles.
- Automated Solver: An algorithm that can find solutions to the recreated puzzles.
- Customizable Grid: Adjustable grid size to accommodate various puzzle complexities.
- Multiple Tile Types: Support for different track types, including straight tracks, curves, and T-junctions.
- Cart Placement: Ability to place and rotate trains on the grid.
- Save/Load Functionality: Save your recreated puzzles and load them later for solving or further editing.
- Python 3.7+
- Tkinter
- Pillow (PIL)
- NumPy
- OpenCV-Python
-
Clone the repository:
git clone https://github.com/yourusername/railbound-puzzle-solver.git cd railbound-puzzle-solver
-
Install the required dependencies:
pip install -r requirements.txt
To launch the puzzle editor:
python editor.py
- Use the grid size controls to set up your puzzle board.
- Select tiles from the dropdown menu and click on the grid to place them.
- Use the "Set Destination" button to mark the goal location.
- Toggle "Cart Place Mode" to add trains to your puzzle.
- Save your created puzzle using the "Save Grid" button.
To solve a puzzle:
python solve.py path/to/your/puzzle.json
Replace path/to/your/puzzle.json
with the path to the JSON file of the puzzle you want to solve.
The solver uses a breadth-first search algorithm to explore possible track configurations. It places tracks, moves trains, and backtracks when necessary to find a valid solution that allows all trains to reach the destination.
- Can solve all of level 1, except for level 1-13A
- Current implementation is too slow due to excessive possibilities
-
Optimize Track Placement Algorithm
- Reduce the number of possible tracks to consider
- Implement a smarter track placement strategy
-
Implement 3-Way Track Generation Rules
- Only generate 3-way tracks when:
- A car intersects with a track
- Only generate 3-way tracks when:
-
Code Refactoring
- Review and refactor code for better readability and maintainability
- Ensure proper commenting and documentation
-
Testing
- Develop comprehensive test cases
- Ensure all levels, including 1-13A, can be solved efficiently
- The key insight is to limit 3-way track generation to specific scenarios, which should significantly reduce the number of possibilities to check.
- Remember that for a 3-way to be useful, it needs to be accessed from all 3 directions.
- The visualization doesn't need to be overly complex; focus on functionality first.
Contributions to the Railbound Puzzle Solver are welcome! Please feel free to submit pull requests, create issues or suggest improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
- This project was inspired by Railbound, a puzzle game developed by Afterburn.
- Special thanks to the Python community for the excellent libraries that made this project possible.
This solver is a fan-made project and is not affiliated with, endorsed, sponsored, or specifically approved by Afterburn or any of its subsidiaries or its affiliates. The official Railbound game is available on Steam, App Store, Google Play, GOG, and Humble Store.