Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   matching squares (http://www.programmingforums.org/showthread.php?t=12323)

cwl157 Jan 7th, 2007 10:22 PM

matching squares
 
Alright heres the problem. I recieved a puzzle for christmas to try and solve. Its not a programming puzzle or anything but i want to make a program to solve it. The puzzle contains 9 squares. Each square has 4 pictures on it. The goal is to match up the pictures on all the squares. here is a link to the website of the company that makes the puzzle because i'm not that good at explaining.
http://www.b-dazzle.com/scramble.asp

The one i have compares different sharks. Basically the side of the square either has a top or a bottom and then the correct top must match the correct bottom.

I am thinking a Square class and have 4 labels in the constructor and then in main create 9 instances of the Square class to match the 9 puzzle pieces i have. I also am thinking in the Square class to have a SquareAmount method that says how many squares are left and accessor methods for the 4 labels to compare them. I want the end result to be a grid of numbers saying which Square goes where and then each square from the puzzle would match a number that the computer program spits out. I do not know how to compare all of these possible combinations though. I thought about just comparing sides of the squares until there is a match but i need to check all sides of every square every time and thats a lot.

cwl157 Jan 7th, 2007 11:55 PM

i think i figured it out. I am gonna use a 2D array implementation of a graph making it 36 by 36 since there are 36 total sides. Then fill out a 0 if those 2 sides match and a 1 if those 2 sides dont match. Then traverse the graph finding all combinations with a 0 as the value and those are the sides that have to be matched up. Also, i am switching to C++ because i have some graph comparisons in C++ before.


All times are GMT -5. The time now is 11:32 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC