Jump to content


Generating A Sudoku Board

  • Please log in to reply
1 reply to this topic

#1 flyingfisch


    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-CG10 PRIZM

Posted 21 December 2012 - 05:01 PM

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. :)

#2 Casimo


    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

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)

Edited by Casimo, 01 January 2013 - 04:11 PM.
Please link to english sites :)

  • MicroPro likes this

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users