Friday, 13 August 2010

Yes, I do have real work to do

And I know I should not be working out if one can write a solver for loops of zen entirely in javascript. No, that would not be real work, even if it is fun...

It would seem the 10x10 ones can often be totally solved with no trial and error - i.e. just deducing where tiles must be a particular way around. It is a bit iterative - you can fix the initial obvious tiles (blank, and 4 way) and then progress to adjacent tiles. Tiles at the edges have less options. Tiles adjacent to ones you are sure of can find their options limited to one choice and so you fix them too, and so on.

The first version looked at 1 way, and 2 way right angle, and 2 way straight, and 3 way tiles distinctly and considered the various options. It is a stupid way to consider it and I have been dumb. I should just "test" the tile all 4 ways around and see how many "fit" against adjacent know tiles. If only one way, fix the tile. It can be done in a loop. How silly of me!

(I'll try that now :-)

Doing the same on the larger ones leaves islands of tiles which have a choice about the way the puzzle is solved, but typically deciding one of them causes the rest to fall in to place.

So, a cheat function that works out what can be statically deduced without trial and error gives a sort of difficulty score for the game - how much can be fixed like this and how much needs trial and error. The trick then is to use this cheat mode to test different ways of making the random puzzle in the first place to determine if they make easier or harder puzzles...

Or, I could get one with the mountain of real work I have to do.

No comments:

Post a Comment