[Coco] Jeweled game done

Roger Taylor operator at coco3.com
Thu May 8 23:36:49 EDT 2008

At 01:10 AM 5/8/2008, you wrote:
>Roger Taylor wrote:
>>All I need is a routine that sets up a scrambled board of gems in a 
>>way that each move leads to another possible move or moves (and 
>>collapse of certain sets of gems) so that the last move clears the 
>>board.  I can't find any algorithms for this on the web even though 
>>there's tons of Bejeweled knock-offs with source code to come.  I 
>>think most don't have a puzzle mode like the one in Bejeweled 
>>2.  It's not like scrambling a 3-D color cube.  I'm probably going 
>>to have to build the board from the bottom rows up, swapping two 
>>gems vertically or horizontally as I insert a vertical or 
>>horizontal set or sets.  I've tried different approaches and the 
>>boards always come out where a 2 year old could solve them.
>         Just a crazy thought. Maybe the algorithm that maze (old X 
> windows maze program) uses to construct its mazes can be adapted?

We'll see.  I also wrote Pelieti for the CoCo 3 which generates 
random mazes for each game, which the computer opponent solves 
efficiently like a real smart lab rat.

By the way, solving a random maze can be done with a very simple 
trick.  You keep an array of Weights that keep track of how many 
times the rat has passed over points in the maze (all 
points).  Looking in 4 directions, always move the rat towards the 
lowest weight.  Since the maze walls get assigned the heaviest 
weight, the rat will automatically and magically turn around at all 
dead ends and always take new paths at splits or 4-ways, etc.  It's 
fun to watch the computer rat explore every part of the maze until it 
solves it, never giving up or getting lost.

More information about the Coco mailing list