View previous topic :: View next topic |
Author |
Message |
codetiger
Joined: 18 May 2006 Posts: 1 Location: chennai
|
Posted: Thu May 18, 2006 2:43 pm Post subject: Sudoku Generator Logic For Mobile Game Developer |
|
|
Generating sudoku puzzle using low CPU power:
Puzzle generator completely depends on the solver technique in terms of efficiency. So we are half the way through. for solver logic see here . The generator logic is bit easy. Usually these are two common ways to generate Sudoku puzzle.
One: filling an empty grip partially with random numbers in random cells and trying to solve it, if there is a unique solution, the puzzle is ready. Else add another number and try solving. if this fails to produce unique solution puzzle try again with filling a different random numbers in random cells. This method is not suitable for mobile phones, coz this takes along time.
Two: take a filled solution grid and hide some cells now try solving it, if more than one solution is possible then hide more cells, if there is a unique solution then stop hiding more cells. This method is simple and faster but requires some code on generating filled solution grid. To generate a filled solution grid you have to use some matrix theorem rather than filling a grid by random numbers. This is the most deciding part of the methods we have used. We have crossed all major tasks now. Your code efficiency and CPU usage depends on this piece of code. I have tried two extremes of coding in this part which results to generation time of 10 mins and the simplest (the on I have implemented now) which takes at the max 3 seconds on a 35 MHz processor.
Mobile Game Developer |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|