I am trying to make a sudoku game in LuaZM. Right now I am stuck at how to generate a board.
So my first question is, does anyone have an algorithm, and my second is if there is already a lua sudoku board generator that i could use without having to reinvent the wheel.
Generating A Sudoku Board
Started by
flyingfisch
, Dec 21 2012 05:01 PM
1 reply to this topic
#1
Posted 21 December 2012 - 05:01 PM
#2
Posted 22 December 2012 - 09:09 AM
There are many ways to do that.
1. You already have a solved sudoku
->delete some numbers (22 to 36 numbers should stay)
2. You want to create a random sudoku
->1.: you generate random numbers in a random place and try to solve it with backtracking until you can't solve it -> then you take the last solveable solution
->2.: you spread nine ones, nine twos, nine threes,... and try to solve with backtracking
->3.: you take a "normal" sudoku and change the lines or reflect them
source: Wikipedia (see Creating new sudokus)
1. You already have a solved sudoku
->delete some numbers (22 to 36 numbers should stay)
2. You want to create a random sudoku
->1.: you generate random numbers in a random place and try to solve it with backtracking until you can't solve it -> then you take the last solveable solution
->2.: you spread nine ones, nine twos, nine threes,... and try to solve with backtracking
->3.: you take a "normal" sudoku and change the lines or reflect them
source: Wikipedia (see Creating new sudokus)
Edited by Casimo, 01 January 2013 - 04:11 PM.
Please link to english sites :)
- MicroPro likes this
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users