Tuesday, January 31, 2012

[daygvtxu] Thoughts on the Eternity II puzzle

Solve Tetravex by simulated annealing.  A huge collection of state transition functions:

* Take a rectangular area and rotate it (perhaps 90 degrees if square).
* Take any two rectangular areas of the same shape and rearrange (double rotations, swaps).  A double rotation is different from sequential single rotations if the areas touch because it avoids the transition state which might have a poor score.
* Take a rectangular area, cut it into 4 pieces with 2 orthogonal cuts, then rearrange the pieces to fit in the area.
* Inverse of the previous (invertible transitions seem like a good idea).
* 3 pieces with 2 parallel cuts.
* Many functions do not uniquely belong to one category, beware of double counting for uniform sampling.

The general idea is to be able to move large areas at once so that "good" regions of matched tiles don't get broken up.

The obvious scoring (fitness) function is number of matched tiles, and this can be evaluated quickly by only looking at the boundaries of edges that changed by the state transition.

We take the scoring function a step further in sophistication by eliminating pairs of tiles which seem to be matched but actually quickly lead to impossibility.  For every 1x2 matched pair of tiles, do a test solve of a 3x4 region around it to make sure it is possible.  Edges make things hairy.

Repeat, but for 2x2 matched blocks.

The number of state transition functions available probably number in the billions or trillions, and late in the simulation, very few may yield positive (or not very negative) change in score.  Evaluate all the possible transitions in parallel in hardware (FPGA) and select among the best.  (Bluespec)

No comments :