https://github.com/flopp/gol-sat
A SAT-based forward/backwards solver for Conway's "Game of Life".
https://github.com/flopp/gol-sat
conways-game-of-life game-of-life gameoflife minisat sat sat-solver satisfiability
Last synced: 2 months ago
JSON representation
A SAT-based forward/backwards solver for Conway's "Game of Life".
- Host: GitHub
- URL: https://github.com/flopp/gol-sat
- Owner: flopp
- License: mit
- Created: 2015-10-17T15:53:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-06-02T14:57:59.000Z (12 months ago)
- Last Synced: 2025-01-22T12:23:44.620Z (4 months ago)
- Topics: conways-game-of-life, game-of-life, gameoflife, minisat, sat, sat-solver, satisfiability
- Language: C++
- Size: 18.6 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GoL-SAT
A SAT-based forward/backwards solver for Conway's "Game of Life".
## Compile
1. Make sure `git`, `cmake`, and `boost::program_options` are installed
2. Clone the repository: `$ git clone https://github.com/flopp/gol-sat`
3. Change into the newly created directory: `$ cd gol-sat`
2. Build: `$ make`## Usage
Run `$ bin/gol-sat -e X pattern.txt` to perform a *backwards computation* consisting of `X` steps an finally yields the pattern specified in the file `pattern.txt`.
Run `$ bin/gol-sat -f -e X pattern.txt` to perform a *forward computation* consisting of `X` steps starting with the pattern specified in the file `pattern.txt`.
## Pattern Format
The text file format used for patterns starts with two numbers specifying the `width` and `height` of the pattern. Then `width` * `height` cell characters follow, where- `.` or `0` is a dead cell
- `X` or `1` is an alive cell
- `?` is an unspecified cellThe `patterns` subdirectory contains some samples.
## Example
The following command performs backwards computation consisting of two evolution steps (option `-e 2`) that finally yield the game of life pattern specified in the file `patterns/smily.txt`:```
$ bin/gol-sat -e 2 patterns/smily.txt
-- Reading pattern from file: patterns/smily.txt
-- Building formula for 2 evolution steps...
-- Setting pattern constraint on last generation...
-- Solving formula...-- Initial generation:
...X.....XX
..X....X...
.X..X....XX
.X.XXX.XX..
..X...XX...
....X..X...
X.X....XXXX
X.XX.X.....
......X..XX
...X.X..X..-- Evolves to:
...........
..XX....X..
.X..XXXX.X.
.X.XXX.XXX.
..X........
.X.X.....X.
..X.X.XXXX.
..XX..XX...
..XX.XX..X.
.........X.-- Evolves to final generation (from pattern):
...........
..XXXXXXX..
.X.......X.
.X.X...X.X.
.X.......X.
.X.X...X.X.
.X..XXX..X.
.X.......X.
..XXXXXXX..
...........
```