Creating a Sudoku Player just for fun...

Programs which generate, solve, and analyze Sudoku puzzles

Creating a Sudoku Player just for fun...

Postby rmlazzari » Thu Jan 14, 2016 12:59 pm

First of all, taking a look at this forum I saw there is realy masters of Sudoku here. Sincerely congratulations for them all. My name is Renato and I'm just an retired old guy trying to spend my free time building a Sudoku player using the old tools I used to work, a programming language called Clipper. Certainly some system's solutions are solved for the people here and there's much better programs already builded. But even so, if somebody could help me with some primarily questions... here we go:

For while I only can build routines to verify:
- coincidences into the lines, columns and groups
- unique absences also in lines, columns and groups



In the next step i want to build a routine to eliminate candidates in lines, columns or groups witch have to cells with exactly the same two candidates.

I'd like to build more than a Sodoku's solver (as it was few or easy) but a program to play the game.

Do you think?...

Must the program calculate automatically the candidates for all cells in backgroud as a cell is filled? I can be a problem for those who use the key wich show the candidates and for some easy games, calculating the candidates could some the entire game...

May I reveal to user a cell containing one only candidate?

Could, the system, reject a guess in the clues-cells? Could it permit edition of this clues-cells? Could it reject a guesse which don't match with the hidden candidates?
When all the table is fullfilled, I can check coincidences in the lines, columns and gorups and say "It's complete now" Congratulations!" automatically or wait the player to ask to check it?

I thought it could be a nice idea to create a "settings" screen (and a settings file to keep these settings) where I could offer option for the user choose witch automatically resource he or she want to use... One of these settings already created is choose the language. The program is originarily in "Português do Brasil" (brazilian portuguese) and reading this post it's easy to you to imagine why, ;)

Thanks for reading me. I'm attaching the infinished sources and the executable, if somebody can see. As it's for DOS (maximum Win XP), if you want to see it working just create a directory in the root of the drive C:, open a DOS windows and call sudoku.exe. The program will crete the needed data files.
Some questions... whatever, pls say to me.

Best regards.

P.S.: If I could I'd like to keep posting future eventual doubts.
P.S.2 - Pls, excuse my not-too-good English.
Attachments
Sudoku.zip
Sources in Clipper and executable
(187.7 KiB) Downloaded 289 times
rmlazzari
 
Posts: 6
Joined: 14 January 2016

Re: Creating a Sudoku Player just for fun...

Postby JasonLion » Thu Jan 14, 2016 3:24 pm

Welcome to the Sudoku Players Forum!

Nearly all of your questions are stylistic choices which can, and have been, decided both ways by previous program designers. You can impose your personal stylistic choices on users of your program, or make the program configurable to work either way. I could tell you my personal preferences, but they aren't shared by all that many people.
User avatar
JasonLion
2017 Supporter
 
Posts: 642
Joined: 25 October 2007
Location: Silver Spring, MD, USA

Re: Creating a Sudoku Player just for fun...

Postby rmlazzari » Thu Jan 14, 2016 7:44 pm

Thanks for the answer and for the welcome too. I't my pleasure.
And as I get deeper my snoop in this forum, I learn I realy do not anything about Sudoku and programs to creating and solving this puzzle...
rmlazzari
 
Posts: 6
Joined: 14 January 2016

Re: Creating a Sudoku Player just for fun...

Postby rmlazzari » Fri Feb 12, 2016 1:11 am

Well... modifications in the first one:

Now you can click almost everything (except the notes space leaving, maybe...) Try, for example, if you want to, to right-click in "Simbolos pendentes", above the table. Or left-click in the same place... Want to take some important notes? Right-click in the Notes area. (But to leave this area, sorry, only if using the ESC in the keyboard... yet.)

You can return to begin ("Alt-F10" or click over the phrase), you can undo moves till the begin of the session (Ctrl-Z)... If you are lazy to leave the mouse and type the numbers in the cells, throught the keyboard, no problem: try to double right or double left click in a cell. And as you're in an empty cell, want to see it's candidates? Hold the right-button over this cell. And don't worry: if you are playing (ciano screen) and want to move to another table, just click (ou press) PgUp (the previous game in the files) ou PgDn (the next one), your moves in the actual game will be saved...

The program is setted not to accept a number wiyh coincidences through the rows, columns ou groups. But you can turn this off clicking in "Alt-V: Verimode ON". The same way, you're are not allowed to change de incial key cell's value. But if you want to, just click on "Alt-F12: Trava casa fixa ON". Or simply press Alt-F12...

If you want to CREATE a new puzzle by yourself, the program will lowly offer you a green screen pressing "INS (or, again, just clicking in "INS: Criar novo jogo".)

The messages are in brazilian portuguese but are simple words, you can change the file "sudolang.txt" in the same folder of the "sudoku.exe". Yet in this folder, you can add new games, copied from magazines, newspapers... wahtever. Just see the example, in the folder, "sudo0001.jxt". To import this to the game, just create another pure-text files as the "sudo0001.jxt" but beware: don't try to use the same name. I intend, someday, to create a routine to administrate these "importations".

It have yet only two resources to solve sudokus: checking a number you're trying to put in a cell through it's rows, columns and groups and... if you have two cells in the same row(columns or group) with exactly the same two candidates, the program will takes these two numbers of the list of the candidates in the others seven cells. It's for rows, columns and groups... now i'm working on other ways to solve a game. For now, just these two ways.

It was originally wrote in Clipper language but now I've added resources as you have to compile the sources with Harbour.

I hope you enjoy this humble program as I'm enjoying doing this... And if you can, please, wrote something about the program.

Thank you!

sudoku.zip
(21.39 KiB) Downloaded 224 times


P.S.: Excuse but this forum accepts no big files. I'm sending the sources, you can compile this with Harbour, using a standard HBMK2 compiler. To install the program just create a folder in the HD ou in a flash memory stick (we call this, in Brazil, a "pen driver"), all the files it needs to work will be created in the same place. And, again, excuse my not-too-good english...
rmlazzari
 
Posts: 6
Joined: 14 January 2016

Re: Creating a Sudoku Player just for fun...

Postby rmlazzari » Mon Feb 22, 2016 11:37 am

Final version. Just for fun. With executable (put in a folder and execute) and sources.

In brazilian portuguese, but you can translate into your own language, files CRIA.TXT (help for creating a new game), IMPTXT.TXT (help for importing from .TXT files to game's file), JOGA.TXT (help for playing), NOTAS.TXT (help for using paralel notes resource) and SUDOLANG.TXT (messages from the program).

Wrote in Harbour programming language.

An explict resource: the program calcultates de candidates looking for fixed or guessed numbers in the rows, columns and groups of the cells.
Hidden resource: when the system finds just two cells in the same row, column or group with exactly the two same candidates it ripps out these two numbers of the related cells... but I'm not sure it is an precise resource.

It's not a solver and it's not for masters, just for fun... or for those who wants to take a look in the Harbour algorithms, things like that.

Click around, enjoy.

In a Google Drive account: https://drive.google.com/file/d/0BwCQcpV0dqcvY3l3OTFuTVhFcU0/view?usp=sharing
rmlazzari
 
Posts: 6
Joined: 14 January 2016

Re: Creating a Sudoku Player just for fun...

Postby rmlazzari » Mon Feb 22, 2016 9:49 pm

rmlazzari wrote:Final version. Just for fun. With executable (put in a folder and execute) and sources.

In brazilian portuguese, but you can translate into your own language, files CRIA.TXT (help for creating a new game), IMPTXT.TXT (help for importing from .TXT files to game's file), JOGA.TXT (help for playing), NOTAS.TXT (help for using paralel notes resource) and SUDOLANG.TXT (messages from the program).

Wrote in Harbour programming language.

An explict resource: the program calcultates de candidates looking for fixed or guessed numbers in the rows, columns and groups of the cells.
Hidden resource: when the system finds just two cells in the same row, column or group with exactly the two same candidates it ripps out these two numbers of the related cells... but I'm not sure it is an precise resource.

It's not a solver and it's not for masters, just for fun... or for those who wants to take a look in the Harbour algorithms, things like that.

Click around, enjoy.

In a Google Drive account: https://drive.google.com/file/d/0BwCQcpV0dqcvY3l3OTFuTVhFcU0/view?usp=sharing


Almost forgot: to use the hidden resource, F12 when in the play screen. You can check the cell candidates (right click in an empty cell) before and after F12...
rmlazzari
 
Posts: 6
Joined: 14 January 2016

Re: Creating a Sudoku Player just for fun...

Postby rmlazzari » Tue Feb 23, 2016 5:09 pm

Important update:

When the user reset the game using F5, the rollback table (Ctrl-Z, undo) now becomes empty too.


New link: https://drive.google.com/file/d/0BwCQcpV0dqcvY3l3OTFuTVhFcU0/view?usp=sharing
rmlazzari
 
Posts: 6
Joined: 14 January 2016


Return to Software