Solve Tilling Puzzle using D. Knuth's Dancing Links Algorithm.
Given a set of 2D coloured rectilinear tiles, and a target board configuration, as bellow:
A single text file (ASCII), different characters to represent the shapes and colors of the tiles; the target configuration is assumed to be the largest tile in that file.
- Simple example above:
......b...bab....abba
.....aa.....a....baba....b
- Large example above txt:
O OXOXO OX
X XO X XO XO XOXOXOXO
O XO X O X OXOXOXOX
X X O XOXOXOXO
X O XO OXOX OXOXOXOX
XOXO O X OX XOXOXOXO
O X OXO O X OXOXOXOX
X O X O OX XOXOXOXO
XO O X XO OXOXOXOX
XO X
O
A html file will be generated that contains the following info:
- Label each piece of rectilinear tiles with a single colour.
- Each tile(cell) in the piece was labelled with id to represent the relative position of the tile in the piece of rectilinear tiles.
- Various solutions on how to organize the pieces into the target configuration.
I have uploaded the complete raw HTML of Larger example solutions.