Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

SUDOKU GENERATOR

Name: Anonymous 2009-03-08 5:04

/prog/ can you make me a sudoku generator that will produce a random sudoku on it's first attempt. Closest I've gotten involved three attempts at max.

Name: Anonymous 2009-03-08 5:10

Sudoku

Name: Anonymous 2009-03-08 6:42

>>2
thanks

Name: Anonymous 2009-03-08 6:45

sudo -ku

Name: Anonymous 2009-03-08 6:54

OP here... /prog/ you can do better than this.

Name: Anonymous 2009-03-08 6:57

>>5
Sudoku

Name: Anonymous 2009-03-08 9:06

>>1
- are you saying you failed and had to edit the code twice before you succeeded?

- or are you saying the program had to be run 3 times without modification, before it successfully produced a random sudoku?

---

Is it a fully-completed sudoku, or one with blanks for publication in a quiz magazine?

Name: Anonymous 2009-03-08 9:13

Generate random 9x9 board, check whether it works, enjoy your O(n^) runtime.

Name: Anonymous 2009-03-08 9:48

>>8
Personally, I wouldn't enjoy it.

Name: Anonymous 2009-03-08 10:25

Sudoku !!!

Name: Anonymous 2009-03-08 10:34

>>9
Do you enjoy your job?

Name: Anonymous 2009-03-08 11:23

>>7
No my code worked on a iterative check whether the sudoku produced was correct. If it was false it would attempt to replace elements marked as unstable. If that failed it would go back to the start and remake the sudoku.

So I guess three times without modification. It generates a sudoku and then, it will make one with unfilled spaces from the already existing one. I'm not a programmer so I don't know the best way to approach creating a sudoku without the problems of incorrect boards being produced.

Name: Anonymous 2009-03-08 11:32

>>11
I'm still in school!

Name: Anonymous 2009-03-08 18:55

I have tried this before about three years ago and found it moderately difficult- namely because I was still using java and was a gigantic faggot. If you don't want to go into some advanced numerical analysis the easiest way perhaps would be to implement a deterministic solver that never guesses, and if it can't solve the puzzle without guessing (i.e.: one solution only) terminates. Then to generate a sudoku start adding random numbers in random places and keep adding more until the solver returns a single solution.

Name: Anonymous 2009-03-08 20:22

Once generated, how do you go about hiding the numbers such that it will have a unique solution?

Name: Anonymous 2009-03-08 20:28

read the source to gnome-sudoku, it's in Python for maximum fappability.

Name: Anonymous 2009-03-08 20:32

>>16
It's actually pretty terrible.

Name: Anonymous 2009-03-08 20:35

>>16
it's high noon on my sundial

Name: Anonymous 2009-03-08 20:45

>>15
Start off with a blank array and add a couple of random elements into it from a completed sudoku. Now you need to check whether those elements give clues to one another or not. If they do, depending on difficulty you remove them and replace or you add more that would give clues. In total mine generally shows about 18 numbers, but can show as many as 30.

Name: Anonymous 2009-03-08 20:54

>>16
Too bloated. Doesn't actually produce a sudoku on it's first attempt.

Name: Anonymous 2009-03-08 22:00

#!/bin/sh

SUDOKU_DIR=$HOME/sudoku

mkdir "$SUDOKU_DIR"
cd "$SUDOKU_DIR"
wget -r -np -l0 -N -nH --cut-dirs=2 -P "$SUDOKU_DIR" -A.png http://www.dailysudoku.co.uk/sudoku/png/

find "$SUDOKU_DIR" | grep -E '/[0-9-]+\.png$' | perl -e 'rand($.) < 1 && ($l = $_) while <>; print $l'


also:
http://www.google.is/search?hl=is&safe=off&q=random+line+from+file&start=20&sa=N
Vegna lagalegrar beiðni sem Google barst, höfum við fjarlægt 1 niðurstöður af þessari síðu. Ef þú vilt getur þú lesið meira um þessa beiðni á ChillingEffects.org.
http://www.chillingeffects.org/notice.cgi?sID=1161
Child Pornography Complaint in Google Search
what the fuck? there was CP in a google result for "random line from file"?

Name: Anonymous 2009-03-08 22:21

>>21
Why you do this?

Name: Anonymous 2009-03-08 22:44

puts "738516429\n659274381\n421389657\n186457932\n972831546\n345962718\n263195874\n517648293\n894723165\n"

I've rand it 5000 times, and the result was always a VALID SUDOKU GRID.
Average performance: 0.00 real         0.00 user         0.00 sys
Median performance: 0.00 real         0.00 user         0.00 sys

Name: Anonymous 2009-03-08 23:04

>>23
Satori

Name: Anonymous 2009-03-09 0:07

>>23
I hate you... I hate you more than all the creationists on earth combined.

Name: Anonymous 2009-03-09 0:36

>>23
produces the same one every time == not random

Name: Anonymous 2009-03-09 0:40

>>20
What about it is first attempt?

Name: Anonymous 2009-03-09 10:21

>>26
That's wrong, I chose it at random.

Name: Anonymous 2009-03-09 10:39


int getRandomNumber()
{
    return 4 //chosen by fair dice role.
             //guaranteed to be random.
}

LOL SO RANDALL XDDD

Name: Anonymous 2009-03-09 10:58

Is that you way of saying ``IHBT''?

Name: Anonymous 2009-03-09 11:27

Name: Anonymous 2009-03-10 2:27

>>31
The only way to produce a perfect sudoku without going through numerous attempts is to solve a board with pre-placed numbers all around the board.

The method that he uses is very similar to mine. If the puzzle is unsolvable it will replace it with a new version of it. At least that's what I think, then again I can't really read Python(I'm not a programmer, and python is hard to understand).

Name: Anonymous 2009-03-10 3:05

>>32
Back to /pr/ please.

Name: Anonymous 2009-03-10 3:19

>>33
Public relations?

Name: Anonymous 2009-03-10 3:26

>>34
1/10 IHBT

Name: Anonymous 2009-03-10 5:14

>>33
http://dis.4chan.org/pr/
404 - Not Found

Name: Anonymous 2009-03-10 18:25

Name: Anonymous 2009-03-10 19:40

>>37
I almost feel for that one, noticed the wakaba.html before the nimp! You almost had me 6/10.

Name: Anonymous 2009-03-11 2:33

>>37
So simplistic. It generates it almost instantly. How'd you find this sudoku generator?

Name: Trollbot9000 2009-07-01 10:56

keep you stupid and not all just  got fukken trolled.

Don't change these.
Name: Email:
Entire Thread Thread List