pip install -r requirements.txt
-
Change directory to this folder and run
python main.py -p [P] -d [D] -
[P]is a puzzle sorted nameSorted name Puzzle name BBinox GGalaxies SSudoku SBStarBattle TTroix SLSlitherlink HMMHaunted Mirror Maze -
[D]is path to problem data -
Example running
python main.py -p SB -d ./data/star_battle/puzzle_1.json -
Help
-hfor more details:python main.py -h -
Example data in
./data/
Note: If you want to solve a new puzzle, you need to model this puzzle follow belowed data structure.
Rules:
- The finished puzzle should be filled with Xs and Os.
- Horizontally and vertically, there should never be a continuous run of the same symbol longer than 2.
- There are an equal number of Xs and Os in each row and column.
- All rows are unique. All columns are unique, too.
Data structure:
{
"shape": [6, 6], // size of puzzle [number of rows, number of columns]
"symbol_number": 2, // max number of the same symbol touching in each row, col
"fixed": [ // fixed cells
{"row": 0, "col": 0, "val": "X"}, // a fixed cell
{"row": 1, "col": 2, "val": "O"},
{"row": 2, "col": 1, "val": "O"},
{"row": 2, "col": 2, "val": "O"},
{"row": 3, "col": 0, "val": "X"},
{"row": 3, "col": 5, "val": "X"},
{"row": 4, "col": 2, "val": "O"},
{"row": 4, "col": 5, "val": "X"}
]
}Example data:
- ./data/binox/puzzle_1.json:
#1in Toughest 6x6 Binox, Volume 1, Book 1 - ./data/binox/puzzle_2.json:
#1in Toughest 8x8 Binox, Volume 1, Book 1 - ./data/binox/puzzle_3.json:
#1in Toughest 10x10 Binox, Volume 1, Book 1 - ./data/binox/puzzle_4.json:
#1in Toughest 12x12 Binox, Volume 1, Book 1 - ./data/binox/puzzle_5.json:
#1in Toughest 14x14 Binox, Volume 1, Book 1
Modeling: ./docs/binox.md
Detail and puzzles: Krazydad
Rules:
- Connect the dots to make edges so that each circle is surrounded by a symmetrical galaxy shape,
- The puzzle is completely tiled with galaxies.
- Each galaxy shape must be rotationally symmetric, having an identical appearance when rotated 180 degrees.
Data structure:
{
"shape": [21, 11], // size of puzzle [number of rows, number of columns]
"galaxies": [ // centers of galaxies
[
{"row": 0, "col": 4} // center of a galaxy
],
[
{"row": 0, "col": 0},
{"row": 1, "col": 0}
],
[
{"row": 0, "col": 5},
{"row": 0, "col": 6},
{"row": 1, "col": 5},
{"row": 1, "col": 6}
],
]
}Example data:
- ./data/galaxies/puzzle_1.json:
#16in 7x7 Galaxy, Book 1 - ./data/galaxies/puzzle_2.json:
#10in 10x10 Galaxy, Book 1 - ./data/galaxies/puzzle_3.json:
#5in 21x11 Galaxy, Book 1 - ./data/galaxies/puzzle_3.json:
#2in 21x21 Galaxy, Book 1
Modeling: ./docs/galaxies.md
Detail and puzzles: Krazydad
Rules:
- Each row, column, block not contain duplicate values
- Value in cell in range [1,
$n$ ]
Data structure:
{
"shape": 9, // size of puzzle
"fixed_cells": [ // fix cells
{"row": 0, "col": 2, "val": 1},
{"row": 0, "col": 3, "val": 6},
{"row": 0, "col": 7, "val": 5},
{"row": 1, "col": 0, "val": 5},
{"row": 1, "col": 1, "val": 3},
]
}Example data:
Modeling: ./docs/star_battle.md
Detail and puzzles: Krazydad
Rules:
- Each puzzle is divided into
$s$ different regions. - Each cage, row and column contains
$n$ (base on$s$ ) star. - The stars may not be adjacent to each other (not even diagonally).
Data structure:
{
"shape": [10, 10], // size of puzzle [number of rows, number of columns]
"star_number": 2, // nStar each row, col, cage
"cages": [
// a cage includes cells
[
{"row": 0, "col": 0}, // a cell in cage
{"row": 0, "col": 1},
{"row": 0, "col": 2},
{"row": 0, "col": 3},
{"row": 1, "col": 0}
],
// other cage
[
{"row": 0, "col": 4},
{"row": 0, "col": 5},
{"row": 0, "col": 6},
{"row": 0, "col": 7},
{"row": 0, "col": 8}
]
// ...
]
}Example data:
- ./data/star_battle/puzzle_1.json:
#1in Star Battle 8x8, Volume 1, Book 1 - ./data/star_battle/puzzle_2.json:
#1in Star Battle 10x10, Volume 1, Book 1 - ./data/star_battle/puzzle_3.json:
#1in Star Battle 14x14, Volume 1, Book 1
Modeling: ./docs/star_battle.md
Detail and puzzles: Krazydad
Rules:
- The puzzle is filled with Xs, Os, and Is.
- Horizontally and vertically, there can be no more than 2 of the same symbol touching (no three-in-a-row).
- There is an equal number of each symbol in each row and column.
Data structure:
{
"shape": [9, 9], // size of puzzle [number of rows, number of columns]
"symbol_number": 2, // max number of the same symbol touching in each row, col
"fixed": [ // fixed cells
{"row": 0, "col": 0, "val": "X"}, // a fixed cell
{"row": 3, "col": 0, "val": "I"},
{"row": 3, "col": 1, "val": "O"},
{"row": 3, "col": 3, "val": "X"},
]
}Example data:
- ./data/troix/puzzle_1.json:
#1in 9x9 TroixPuzzles, Volume 1, Book 1 - ./data/troix/puzzle_2.json:
#1in 12x12 TroixPuzzles, Volume 1, Book 1 - ./data/troix/puzzle_3.json:
#1in 15x15 TroixPuzzles, Volume 1, Book 1 - ./data/troix/puzzle_4.json:
#1in 21x21 TroixPuzzles, Volume 1, Book 1
Modeling: ./docs/troix.md
Detail and puzzles: Krazydad
Rules:
- Connect horizontally or vertically adjacent dots to form a meandering path that forms a single loop, without crossing itself, or branching.
- The numbers indicate how many lines surround each cell. Empty cells may be surrounded by any number of lines (from 0 to 3).
Data structure:
{
"shape": [7, 7], // size of puzzle [number of rows, number of columns]
"surrounded_line_number": [ // number of lines surround cells
{"row": 0, "col": 0, "val": 2},
{"row": 0, "col": 1, "val": 2},
]
}Example data:
- ./data/slitherlink/puzzle_1.json:
#1in Tough Slitherlink Puzzles, 7 x 7 Format, Volume 1, Book 1 - ./data/slitherlink/puzzle_2.json:
#1in Tough Slitherlink Puzzles, 10 x 10 Format, Volume 1, Book 1 - ./data/slitherlink/puzzle_3.json:
#1in Tough Slitherlink Puzzles, 20 x 20 Format, Volume 1, Book 1
Modeling: ./docs/slitherlink.md
Detail and puzzles: Krazydad
Rules:
- Fill each empty box of the puzzle grid with the right monster: a ghost, vampire, or zombie
- The clues along the edges tell you how many monsters you can see from that point looking into the grid, and the diagonal lines are mirrors that reflect a line of sight 90 degrees, as with a laser..
- Vampires (V) are seen only head-on (have no reflection in a mirror).
- Ghosts (G) are only seen as reflections in mirrors (not head-on).
- Zmobies (Z) are always seen.
- Each puzzle also has a handy list of monsters so you know how many of each type are hiding in that mirror maze.
- Some cells contain the same monsters.
- Some cells contain fixed monsters.
Data structure:
{
"shape": [7, 7], // size of puzzle [number of rows, number of columns]
"visibility": { // number of monsters you can see from that point looking into the grid
"top": [0, 1, 3, 12, 1, 1, 1],
"bot": [1, 1, 3, 1, 1, 1, 1],
"left": [0, 2, 1, 4, 2, 0, 1],
"right": [3, 2, 2, 2, 11, 2, 1]
},
"mirrors": [ // mirrors position
{"row": 0, "col": 0, "val": "/"},
{"row": 0, "col": 1, "val": "/"},
{"row": 0, "col": 2, "val": "\\"},
{"row": 0, "col": 3, "val": "\\"},
{"row": 0, "col": 4, "val": "\\"}
],
"monster_number": [ // number of each type of monsters are hiding in that mirror maze
{"name": "V", "val": 19},
{"name": "G", "val": 20},
{"name": "Z", "val": 10}
],
"fixed_cells": [
{"row": 5, "col": 3, "val": "Z"} // fixed monster cells
],
"same_cells": [ // cells contain the same monsters
{"row": 1, "col": 2},
{"row": 4, "col": 5},
{"row": 5, "col": 0}
]
}Example data:
- ./data/haunted_mirror_maze/puzzle_1.json:
#1in Haunted Mirror Maze, 6 x 6 Format - ./data/haunted_mirror_maze/puzzle_1.json:
#2in Haunted Mirror Maze, 7 x 7 Format
Modeling: ./docs/slitherlink.md
Detail and puzzles: Krazydad
- Đang phát triển