Generates synthetic datasets for the Hashiwokakero (Hashi / Bridges) puzzle. The agent must connect numbered islands with horizontal or vertical bridges so that each island's degree matches its number, no bridges cross, and the whole network is fully connected — a CSP with global graph-connectivity constraints.
Each sample pairs a task (first frame + prompt describing what needs to happen) with its ground truth solution (final frame showing the result + video demonstrating how to achieve it). This structure enables both model evaluation and training.
| Property | Value |
|---|---|
| Task ID | Multi-17 |
| Task | Hashi (Bridges) Puzzle |
| Category | Constraint Satisfaction Puzzles |
| Resolution | 1024×1024 px |
| FPS | 16 fps |
| Duration | varies |
| Output | PNG images + MP4 video |
# 1. Clone the repository
git clone https://github.com/VBVR-DataFactory/Multi-17_hashi_bridges_data-generator.git
cd Multi-17_hashi_bridges_data-generator
# 2. Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# 3. Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .# Generate 50 samples
python examples/generate.py --num-samples 50
# Reproducible generation with seed
python examples/generate.py --num-samples 50 --seed 42
# Custom output directory
python examples/generate.py --num-samples 100 --output data/my_dataset
# Without videos (faster, images only)
python examples/generate.py --num-samples 50 --no-videos| Argument | Description |
|---|---|
--num-samples |
Number of tasks to generate (required) |
--output |
Output directory (default: data/questions) |
--seed |
Random seed for reproducibility |
--no-videos |
Skip video generation (images only) |
[Scenario] The image shows a Bridges (Hashiwokakero) puzzle consisting of numbered circles (islands) scattered on a grid.
[Rules]
1. Islands must be connected by drawing horizontal or vertical straight bridges. Bridges cannot cross each other or other islands.
2. Two islands can share at most two parallel bridges.
3. The number on each island must strictly equal the total number of bridges connected to it.
4. All islands must be interconnected into a single group.
[Task] Generate a video solving the Bridges puzzle. Animate the step-by-step drawing of the bridges until a valid, fully connected layout is achieved.
![]() |
![]() |
![]() |
| Initial Frame Numbered islands without any bridges |
Animation Bridges drawn one segment at a time |
Final Frame Fully connected island network satisfying all degree counts |
Connect numbered islands on a grid using horizontal/vertical bridges so that each island's number equals the total bridges incident to it, no two bridges cross, and the whole graph is connected.
- Grid: A grid hosting N islands (each with a number 1–8).
- Bridges: Straight horizontal or vertical lines between two islands.
- Multiplicity: At most 2 parallel bridges between any pair of islands.
- Crossing: Bridges of different orientations may not intersect.
- Degree constraint: Each island's number = sum of bridge ends touching it.
- Global connectivity: The resulting bridge graph must be a single connected component.
- Solver: SAT/integer-programming–style solver yields the unique valid solution.
- Local degree + global connectivity: Combines per-vertex constraints with a global topological invariant.
- Crossing-aware planning: Choosing one bridge can pre-empt entire alternative crossings, requiring lookahead.
- Stepwise drawing: The video reveals one valid bridge at a time, providing a sequence model can be evaluated against.
- Distinct from Sudoku/Numbrix: Constraints are graph-theoretic, not row/column based.
data/questions/Multi-17_hashi_bridges_data-generator_task/Multi-17_hashi_bridges_data-generator_00000000/
├── first_frame.png # Numbered islands, no bridges
├── final_frame.png # Fully connected solution
├── prompt.txt # Task instruction with full ruleset
├── ground_truth.mp4 # Animation of bridge drawing
└── question_metadata.json # Standardized VBVR task metadata
File specifications:
- Images: 1024×1024 PNG format
- Video: MP4 format, 16 fps, H.264 + yuv420p
- Metadata: VBVR canonical schema with
task_id,vbvr_task_code,media,parameters
hashiwokakero hashi bridges csp graph-connectivity degree-constraint multi-step-reasoning
Part of the 36-Task Long-Horizon Multi-Step Reasoning Benchmark.


