Wang tiles solver

A simple Wang-tiles solver.

You can represent the tiles as a tree. You start at the root node and try to fit a Tile into this spot. If you succeed, you move to a deeper node, if you can’t find a tile that matches, you move up in the tree.

At the end you either end up reset this node to 0 and move a final node w * h levels deep, or at the root node with no more possible tiles to fit here.