This is a constructor for Minesweeper Sudoku, written in Python.
Original prompts for gen_puzzles.py (now modified quite a bit):
-
Make a new script for generating puzzles. gen_puzzles.py. It'll use argparse to get some optional params -n <nbr_puzzles> and -r <random_seed>. Number puzzles defaults to 1, random seed defaults to 0. It'll loop and produce each puzzle, one per line, using the format In my testsuites/sample_puzzles.tsv file. The generate_puzzles function should call generate_candidate_answer, generate_fully_clued_puzzle, and refine_puzzle. generate_candidate_answer, should use the method in test_random.py to generate a random answer string. generate_fully_clued_puzzle will generate a string where each mine is a dot, and every other square is the number of adjacent mines. Leave refine_puzzle blank for now and just have it return the fully-clued puzzle that is passed into it.
-
Okay, the refine_puzzle will do three refinement_passes. In each one, it will start with the fully-clued puzzle and remove clues, randomly (using a shuffled address list), one-at-a-time. It will then call solve() on the modified puzzle, with no other arguments. If the solver does not return an 81 character string, then it will restore the deleted clue, since it's necessary to solve the puzzle. After going through all the clues, the remaining clues are necessary. It will keep the puzzle with the fewest number of clues after the 3 passes, and return that.
-
In the main function please add some elapsed time measurement and report it at the end. (Manually fixed issue with seeding random generator)
- Added command line feedback comment using CMD-K
- Manually fixed it to make zero-clues optional, default is no zeros
- Added support for annotations in solver. Reporting on OR-Tools branch count. Regenerated test suites with this info.
- Added support for multiple solvers via --solver param.
- Added preliminiary PR (production-rule) solver which reports different things than the OR-Tools solver.
- Added --max-tier parameter to limit difficulty of output puzzles when used with PR solver.
- Modified solvers to put most optional arguments in a dictionary.
- Added --min-tier parameter to limit difficulty of output puzzles when used with PR solver.
- Added --reduction_passes parameter to control number of refinement passes.
- Modified test suites / output format to include name, max-tier, and optional layout
- Added output file option to gen_puzzles.py
- Added a hard-tier (3) rule, and generated 3 tiers of puzzles (easy, medium, hard)
- Each test suite is sorted by work
- Added test suites
- Optimization
- Added rules bestiary and an additional medium rule.
- Added additional drawing and annotation options to support bestiary.
- Finalized choices for make and print scripts. Published interactive and print puzzles at krazydad.