scriptod 74ca7d42aa | ||
---|---|---|
include | ||
src | ||
Makefile | ||
README.md |
README.md
Galaxies Puzzle Generator and Solver
This project generates and solves Galaxies puzzles, a type of logic puzzle invented by Nikoli. In Galaxies, the goal is to divide a rectangular grid into "galaxies" around given center points, where each galaxy is 180° rotationally symmetric.
Features
- Generate Galaxies puzzles of customizable size
- Solve generated puzzles
- Output puzzles in both graphical (PBM) and ASCII formats
- Create a separate directory for each generated puzzle
Building the Project
To build the project, you need a C compiler (like gcc) and make. Navigate to the project directory and run:
make
This will compile the project and create an executable named galaxies
.
Running the Program
To run the program:
./galaxies [seed] [size]
seed
(optional): An integer used to seed the random number generator. If not provided, the current time will be used.size
(optional): The size of the puzzle grid (between 5 and 20). Default is 10.
For example:
./galaxies 12345 15
This will generate a 15x15 Galaxies puzzle using seed 12345.
Output
The program creates a new directory for each generated puzzle, named puzzle_[seed]
. In this directory, you'll find:
unsolved.pbm
: The unsolved puzzle in PBM (Portable Bitmap) formatsolved.pbm
: The solved puzzle in PBM formatsolved.txt
: An ASCII representation of the solved puzzle
PBM Format
The PBM files are simple black and white images:
- In the unsolved puzzle, only the galaxy centers are marked.
- In the solved puzzle, the full galaxy shapes are shown.
You can view these files with most image viewers.
ASCII Format
In the ASCII representation:
- 'O' represents galaxy centers
- '#' represents filled cells (part of a galaxy)
- '.' represents empty cells
Project Structure
main.c
: Main program logicgenerator.c
: Puzzle generation logicsolver.c
: Puzzle solving logicoutput.c
: Functions for outputting puzzlesutils.c
: Utility functions
Contributing
Contributions to improve the puzzle generation, solving algorithm, or add new features are welcome. Please feel free to submit issues or pull requests.