Sudoku Generator Logic for Mobile Games

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Sudoku Generator Logic for Mobile Games

Postby DevelopmentTeam » Sat Aug 26, 2006 7:11 am

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.
User avatar
Site Admin
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Sudoku Generator

Postby Namz » Tue Mar 13, 2007 4:40 am


We are developing a sudoku game on a cell phone using J2ME. We are following the second method mentioned above. But We are getting an error -"Out of Memory Error" in the generator code on the emulator which we are not able to debug.
So, we would like to know if there are any memory constraints in the emulator. If so, how can we change it?
Or is it a logical error?

Thank You!
Posts: 9
Joined: Tue Mar 13, 2007 3:43 am

Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 1 guest