Idea for Ruby Quiz - Su Doku solver

L

Lyndon Samson

How the following look?

From http://news.bbc.co.uk/1/hi/magazine/4469719.stm

For those who don't know, it's a puzzle found in newspapers, books and
online. A simple-looking grid of nine rows by nine, split into nine
boxes, each containing nine squares, it looks like just another
numbers game.

But, say Su Doku experts, the difference is it can be played using
logic alone, so maths phobics read on.

To be pure Su Doku each of the unique puzzles - which come in varying
levels of difficulty - must have only one solution. The aim? To fill
in the grid so that every row, every column, and every box contains
the digits one to nine
 
B

Bill Guindon

After doing this evil game for an hour or so now, I agree. I think
programming a puzzle maker is harder than solving it automatically.
More useful, too. :)

Evil game, beware.

"He is pleased with the global growth of the game, to which he
contributed by taking it from a puzzle book he bought in Tokyo in 1997
and spending six years - "on and off" - writing a computer program
that produces new Su Dokus on the spot."

If somebody does this in 3 days with Ruby, it's probably gonna make
this guy cry.
 
D

David A. Black

Hi --

"He is pleased with the global growth of the game, to which he
contributed by taking it from a puzzle book he bought in Tokyo in 1997
and spending six years - "on and off" - writing a computer program
that produces new Su Dokus on the spot."

If somebody does this in 3 days with Ruby, it's probably gonna make
this guy cry.

There's no crying in Ruby!! :)


David
 
V

Vance A Heron

I wrote a solver in Ruby in about 2 hrs - not pretty, but it
works. As mentioned by Christian, I used the same approach as
the 8-queens problem. I'm using the int[][] notation...

Solving runs fast enough in ruby - no need for 'C'. I find
it interesting to note the number of times you need to backtrack
in the puzzles rated "fiendish" difficulty. (In some, there
no backtracking at all!).

I'll think about a generator tomorrow - but it seems that much
of the "difficulty" is determined by *which* numbers you remove
from the answer. I haven't spent much time playing by
hand, but I'm figuring the difficulty from a computer stantpoint
is directly related to the bactracking. Looking at it, one might
be able to start recognizing patterns and make choices that require
less backtracking.

Vance


Florian Groß said:
What about NArray?

It exists, but where is the advantage over int[][]?

Anyway, I quickly wrote a Su Doku solver in gprolog, you can look at
it here:

http://rafb.net/paste/results/1ogo8j31.html

There are languages that have even less support for 2d-arrays. :)

Happy hacking,
 
J

James Edward Gray II

I wrote a solver in Ruby in about 2 hrs - not pretty, but it
works. As mentioned by Christian, I used the same approach as
the 8-queens problem. I'm using the int[][] notation...

This sounds like a fine difficultly for a Ruby Quiz problem then.
Anyone willing to write up the quiz and send it to
(e-mail address removed)? I will sure run it.

James Edward Gray II
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top