Having fun with sudoku!

Stating the obvious. What my "Briefly described subject of my message, in one phrase" means, what I mean is coding a program which can load and save a sudoku, solve it and display all possible solutions, and porhaps guide the user throu the procedure to the solution.

It's a sweet thing to program when you're a beginner if you ask me, err, at least I cant wait to finish this pice of code.

What I want to talk about here is the algorithm for the process itself, the sudoku file for loading and saving it, to figure out the best solution, most optimised code.



So let me start, in hope of finishing, with a structure that will contain a field of a 9x9 sudoku.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
boolean * field;

//[1][2][3][4][5][6][7][8][9] 9 bits for one square, 81 squares, means 729 bits, which is ~92 bytes

field = new boolean[92];

//Ment for saving the sudoki when solving it, RAM.

boolean * field;

//[1][2][4][8] 4 bits for one square, 81 squares, means 324 bits, which is ~41 bytes

field = new boolean[41];

//Ment for saving a sudoku, solved or not, on hard drives. 



When I'll have time I'll write how a good programmer adviced me to write the algorithm for getting all the solutions. Also, I'll post WIP code... C&C apprechiated!


Gregor
closed account (z05DSL3A)
I don't know if you know but there is a thread in the Lounge on this subject (Project Idea: Sudoku Solver [1]) that may be of interest.


[1] http://www.cplusplus.com/forum/lounge/2299/
Topic archived. No new replies allowed.