Giter VIP home page Giter VIP logo

tilesat's Introduction

TileSAT

Reduces the Wang tiles problem, aka Wang dominoes, to CNF SAT and solves it with minisat.

A python script made by Pol Barrachina that can be used to draw the solutions is also included.

aperiodic11_40_40

Building

To build you'll need a C++17 compiler, make and the gzip library, all of which are readily available for most distros. You need the minisat solver installed. Optionally to draw the solutions as SVG images you'll need Python3, the library tkinter and a graphic enviroment.

tkinter and canvasvg are only required if you want to draw the solutions. pip3 is the easiest way to install canvasvg.

Installing dependencies on Debian based distros

sudo apt install libz-dev minisat python3-pip python3-tk
sudo pip3 install canvasvg

Installing dependencies on Arch based distros

sudo pacman -S minisat zlib python-pip
sudo pip3 install canvasvg

Compiling

From within the TileSAT root directory run

make

Running

Solve and print the solution in ASCII

build/tileSAT -p input/aperiodic11

Solve, draw and open the graphic solution

build/tileSAT -d input/aperiodic11
xdg-open output/aperiodic11_*

Usage

Usage: tileSAT [Options]... <TilesProblemFile> Options:

  • -p print solution in console
  • -d drawTiles (requires python3, drawTiles.py, tkinter and canvasvg)
  • -g don't solve, only generate cnf. Invalidates other options

Input format

The first line contains 4 parameters: number of tiles (nTiles), number of colors (nColors), width and height. The next nTiles lines contain the colors of each tile. Each line contains 4 integers, separated by space, which are the index of the colour of each side of the tile, starting from north/up and rotating clockwise. Color indices range from 1 to nColors (inclusive).

Limitations/quirks

  • The program assumes you have minisat installed in your PATH
  • The -d parameter assumes you have python3 in your PATH
  • drawTiles.py has to be present in the current directory
  • -g option creates the gziped cnf file in tmp/out.cnf.gz

TODO (or not)

  • Explore if the SVG can be created without a graphic enviroment
  • Only generate the CNF file on a specified path
  • Only transform minisat result to ASCII solution
  • Integrate minisat to solve without creating a file while avoiding a dependency

tilesat's People

Contributors

marccane avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.