commit a49a69acd533ae70ec2ecb31ea80c1ca027b5c1b Author: scriptod Date: Wed Jun 26 21:18:45 2024 +0300 And it begins... diff --git a/README.md b/README.md new file mode 100644 index 0000000..8cb2750 --- /dev/null +++ b/README.md @@ -0,0 +1,74 @@ +# 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: + +1. `unsolved.pbm`: The unsolved puzzle in PBM (Portable Bitmap) format +2. `solved.pbm`: The solved puzzle in PBM format +3. `solved.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 logic +- `generator.c`: Puzzle generation logic +- `solver.c`: Puzzle solving logic +- `output.c`: Functions for outputting puzzles +- `utils.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.