I am trying to write the code to populate a 9 by 9 grid of tiles with 40 pairs of matching tiles.
I have 4 different types of tiles and I want to create a grid that has 40 matching pairs and 1 blank tile. I do not want the pairs all to be next to each other but there needs to be at least one solution that enables a player to match each and every pair. To match a pair there needs to be a clear path between each member of the pair. 1,2,1 2,0,3 4,4,3 In this simple example, a user could clear all tiles by matching in the following order: 4 - 4 3 - 3 2 - 2 1 - 1 Note that until they have matched the pair of 2's they cannot match the 1's as there would be no clear path between them. All my attempts so far to create this grid is resulting in script errors due to my code being unable to find a solution. My code basically gets about 60% of the board created then finds it cannot any more clear paths to create the remainder of the grid. I would really appreciate any help cracking this function. Thanks Paul _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

