okay, i don't have a problem coding the game... that part would be easy. but the problem is to output the lease number of rotations needed to complete the game, so for example...
123 => 413
456 => 526
789 => 789
(rotation of the top left corner)
that's what it should look like after rotations.
now, i did some study, spent some time figuring the facts, and if i'm correct, the number of possible layouts of a 3*3 square is 9 factorial... which is uhmm... 362880. so even if i tried doing all the possible layouts, i wouldn't get the good result cause i have tho have the right sequence of operations... so, as i know nothing about the np-completeness.. (btw. is it?)i figured i better ask here as i really have no idea..
gregorynoob
2
Junior Poster in Training
Recommended Answers
Jump to PostWhats your game all about? Please Explain?
Jump to Postit's about having a board with 9 numbers, 1-9 obviously. they are organized in a 3*3 matrix.
the solved problem looks like:
123
456
789
the problem is, you are given a scrambled matrix, and you have to fix it using 4 possible moves, rotate top left 2*2, top right, …
Jump to PostIt's called a depth-first search since you know the maximum number of moves.
Start with the unsolved starting point
3 5 2
8 7 1
4 6 9
Then generate the first possibilities with upper-left
1)
832
751
469
saving this solution
Then rotate again,
2)
782
351
469
…
All 11 Replies
Sky Diploma
571
Practically a Posting Shark
gregorynoob
2
Junior Poster in Training
VernonDozier
2,218
Posting Expert
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
gregorynoob
2
Junior Poster in Training
Sky Diploma
571
Practically a Posting Shark
gregorynoob
2
Junior Poster in Training
Sky Diploma
571
Practically a Posting Shark
peterfosterfca
0
Newbie Poster
AmerJamil
-4
Junior Poster in Training
frogboy77
73
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.