Skip to content
Snippets Groups Projects
README.md 1.13 KiB
Newer Older
# PS Logic Colorable-Map SAT Solver
This solves colorable maps like e.g. in the bonus exercise of Week 04 (SS2023) in PS Logic.

It can handle all svg-like maps.

## How does this work

It parses a map out of the svg file, it only supports overlapping in all possible ways and uses Decimal instead of floats, so if your number is below 28 digits of precision, rounding errors shouldn't occur and it ignores non overlapping edges. 
It then creates a CNF out of these map tiles and the given `color_amount` and solves it (tries to solve it, for `color_amount < 4`there is no solution).

## How to use this

See `examples/main.py` for the example, copy that and adapt it to your needs!

## Python requirements

Just execute these commands:

```bash
pip install pipenv -U # can be omitted, if pipenv is already installed
pipenv install # add '--dev' if you want to develop the package itself and want some lint and format tools (I use vscode as setup)
pipenv run <whatever>
```


## Notes

This should run on every OS with python >= 3.12. But I only tested it on Linux, feel free to submit a MR (PR in github terms) or to open an Issue.