Advertisement

in search of a jigsaw algorithm

Started by July 05, 2002 06:27 AM
3 comments, last by athena 22 years, 4 months ago
Any ideas, pointers or URL on how to generate a jigsaw map?
Delphi::Athena
This is how I would handle it:

Load up an array with thousands of random shapes that make up the cut on a single edge. You have to somehow ensure that none of them are the same shape (possibly made up of a few line segments to define the shape, or in the case of pure 2D, various colorkey masks)

Now when you plan to cut a picture into pieces, choose a random array index for each place two pieces will touch. Never choose the same one. The algorithm should allow you to reorient the cut 0, 90, 180, or 270 degrees depending on where on the piece the cut is

For puzzle reassembly, if the ID for the left side of a piece comes into contact with the right side of a piece with the same shape ID, it is a match.

I know this doesn''t solve all the problems (such as HOW to render the pieces), but hopefully it''s a start.

Sorry, I don''t have any links.
It's not what you're taught, it's what you learn.
Advertisement
Have you tried searching the Google usenet archives? I''m sure I recall seeing a thread on this subject about a year or so ago. Worth a try anyway...



Stimulate
thanks you all. I searched google but found only theorical articles.
Delphi::Athena
which is all you need to create an implementation. theory leads the how and sometimes why things are done. MUCH more important then an actual implementation. granted it requires more work and debugging, but at least once you understand the concepts its just a matter of writing the code.

at least try to create an implemenation, and post questions regarding sepcific problems you are having.

[edited by - a person on July 16, 2002 12:12:08 AM]

This topic is closed to new replies.

Advertisement