contraint input

Programs which generate, solve, and analyze Sudoku puzzles

contraint input

Postby dfhwze » Sun Feb 19, 2006 12:05 pm

Hi,

I'm currently making a sudoku-solver in java-code.
'cause i can't work yet with graphical interfaces and applets
I have to do it the old-fashioned way.

My program asks the user if he/she wants to add another constraint on the puzzle untill answer is NO!.
To get the number on the right position the user has to give the row-number , col-number and constraint-number of a cell (456 means 4th row , 5th colom , number 6).

This is a user-unfriendly way of getting the starting-puzzle set.
Does anyone know a quiker, more friendly way of getting the input without graphical interface?
dfhwze
 
Posts: 7
Joined: 12 February 2006

Postby vidarino » Sun Feb 19, 2006 12:24 pm

Many command-line programs use a simple string to input the whole puzzle.

For example, this puzzle:
Code: Select all
+-------+-------+-------+
| . 5 . | 4 . 8 | 1 . . |
| . 8 . | . 5 . | . . . |
| 9 . . | 3 . . | . 4 . |
+-------+-------+-------+
| 5 1 . | . . 6 | . . . |
| 6 . . | . . . | . . 2 |
| . . . | 8 . . | . 7 5 |
+-------+-------+-------+
| . 4 . | . . 3 | . . 6 |
| . . . | . 4 . | . 2 . |
| . . 6 | 5 . 2 | . 3 . |
+-------+-------+-------+


... could be input with this string:
.5.4.81...8..5....9..3...4.51...6...6.......2...8...75.4...3..6....4..2...65.2.3.

Other solvers incorporate smarter methods, as well, such as actually parsing the laid-out version of the puzzle above, and some can parse complete candidate lists, so that they can work with a puzzle in a particular state (i.e. after some eliminations that didn't solve a cell).

Vidar
vidarino
 
Posts: 295
Joined: 02 January 2006


Return to Software