Sudoku editor/Solver
|
12-02-2014, 08:29 PM
(This post was last modified: 02-01-2015 09:23 PM by lenborje.)
Post: #1
|
|||
|
|||
Sudoku editor/Solver
Sudoku_V1.2b_HP_Prime.zip (Size: 29.77 KB / Downloads: 98) This is a Sudoku editor/solver for the HP Prime. The GUI is a bit rough, but serviceable. I submit the code in two file variants, UTF-8 text file and binary. Thanks Thomas for helping me with the binary file. (I have a Mac and can not run the Connectivity Kit directly.) The GUI includes:
Have fun! Edit: Updated the game. I have corrected the bug Han found, improved the layout of the board (cf. pictures) and improved speed 10%-30%. Have fun! Edit: Second, minor, update. zip updated per: (02-01-2015 01:48 PM)Thomas_Sch Wrote: Hello Lennart, /Lennart Börjeson Stockholm, Sweden |
|||
12-03-2014, 07:10 PM
Post: #2
|
|||
|
|||
RE: Sudoku editor/Solver
I get an empty program when I open it... ?
http://mic.nic.free.fr - Youtube - Facebook |
|||
12-04-2014, 07:06 AM
(This post was last modified: 02-01-2015 09:25 PM by lenborje.)
Post: #3
|
|||
|
|||
RE: Sudoku editor/Solver
(12-03-2014 07:10 PM)Mic Wrote: I get an empty program when I open it... ? Strange, as far as I can see the zip is correct. Here's the code (rather big, you'll have to scroll a lot): Code: #pragma mode( separator(.,;) integer(h32) ) /Lennart Börjeson Stockholm, Sweden |
|||
12-04-2014, 01:18 PM
Post: #4
|
|||
|
|||
RE: Sudoku editor/Solver
I've found an error in the program where it tried to call an external routine. This has been fixed. Both the attachment in the original post and and the code in my follow-up has has been corrected.
/Lennart Börjeson Stockholm, Sweden |
|||
12-08-2014, 03:14 PM
Post: #5
|
|||
|
|||
RE: Sudoku editor/Solver
Downloaded 2014-12-08 - programme is extremely empty.
|
|||
12-09-2014, 12:55 AM
Post: #6
|
|||
|
|||
RE: Sudoku editor/Solver
Very cool!
Some minor bugs and suggestions: [Bug] Press solve. After solving, press the Help menu option, and then press a button or tap the screen for invalid input error. [Suggestion] Perhaps the pre-filled values should be in bold. And bold the lines that separate the "blocks" of numbers to make it easier to read a block within the puzzle. Lastly (though it may slow down the solver), having the solver use a different color as it tries out various guesses would help. Even printing its intermediate guesses would help in cases where the puzzle is large. Otherwise, the user may think the program has "hung". Graph 3D | QPI | SolveSys |
|||
12-09-2014, 07:51 AM
Post: #7
|
|||
|
|||
RE: Sudoku editor/Solver
(12-09-2014 12:55 AM)Han Wrote: [Bug] Press solve. After solving, press the Help menu option, and then press a button or tap the screen for invalid input error.Thank you; I'll look into that. (12-09-2014 12:55 AM)Han Wrote: [Suggestion] Perhaps the pre-filled values should be in bold. And bold the lines that separate the "blocks" of numbers to make it easier to read a block within the puzzle. Lastly (though it may slow down the solver), having the solver use a different color as it tries out various guesses would help. Even printing its intermediate guesses would help in cases where the puzzle is large. Otherwise, the user may think the program has "hung".I'll see what I can do about the colours. I did think about it, but right now the algorithm makes no difference between intermediate and original values. Regarding printing intermediate values: The program already does. Did you run the program in the emulator? I've noticed that when running the Sudoku program the emulator does not update the screen unless you constantly move the (PC) mouse over the screen. /Lennart Börjeson Stockholm, Sweden |
|||
12-09-2014, 07:58 AM
Post: #8
|
|||
|
|||
RE: Sudoku editor/Solver
(12-08-2014 03:14 PM)Gerald H Wrote: Downloaded 2014-12-08 - programme is extremely empty. As far as I can determine, the zip is OK. Here's the output of unzip -l on a freshly downloaded copy: Code: $ unzip -l Sudoku_V1.1_HP_Prime.zip If you can't use the zip, you could perhaps cut-and-paste from my recent post in this thread where I quoted the entire code? /Lennart Börjeson Stockholm, Sweden |
|||
12-09-2014, 01:48 PM
Post: #9
|
|||
|
|||
RE: Sudoku editor/Solver
(12-09-2014 07:51 AM)lenborje Wrote: I'll see what I can do about the colours. I did think about it, but right now the algorithm makes no difference between intermediate and original values. I did indeed run it on the emulator (running inside Wine, in too). I'll try again with the actual calculator. Graph 3D | QPI | SolveSys |
|||
01-31-2015, 02:26 PM
Post: #10
|
|||
|
|||
RE: Sudoku editor/Solver
(12-09-2014 12:55 AM)Han Wrote: [Bug] Press solve. After solving, press the Help menu option, and then press a button or tap the screen for invalid input error. I have solved the bug, and improved the layout of the board (bold lines between blocks). I've also improved speed quite significantly. Colouring intermediate values is still not solved. I've updated my original post on this thread with new attachments. /Lennart Börjeson Stockholm, Sweden |
|||
01-31-2015, 04:14 PM
(This post was last modified: 01-31-2015 04:18 PM by Thomas_Sch.)
Post: #11
|
|||
|
|||
RE: Sudoku editor/Solver
(01-31-2015 02:26 PM)lenborje Wrote: ... Hello lenborje, many thanks for your program! Now i mastered to get it running on the prime. I have two suggestions: 1. because your files are more or less pure text (and not .hprpgm), you should name it *.txt. I've tried to send the .hpprgm via connectivity kit to the prime, this did not work. Opening your files with notepad++, converting line endings to windows type, and copying the code to the connectivity kit helped. 2. In line 241 there is a call to subroutine BIT(), this led to an syntax error. Code: MSGBOX("Possible digits are: "+STRING(BITS(displayGrid(highlightR,highlightC)))); Thomas |
|||
02-01-2015, 01:26 PM
Post: #12
|
|||
|
|||
RE: Sudoku editor/Solver
(01-31-2015 04:14 PM)Thomas_Sch Wrote: Hello lenborje,Well, I guess guess I need some help here... I don't have windows so I can't use the connectivity kit. I have Mac and use libhpcalcs, a command-line utility. When I transfer the Sudoku program from my Prime to my Mac I get a file called "Sudoku.hpprgm", encoded in 16-bit unicode, which I believe should be native to Windows. But I should perhaps also convert it to DOS line endings? To be able to edit the file on my Mac I first convert it to UTF-8 encoding. This file is called "Sudoku.utf8.hpprgm". I don't know if this file can be used on Windows. Which file did you use on Windows? (01-31-2015 04:14 PM)Thomas_Sch Wrote: 2. In line 241 there is a call to subroutine BIT(), this led to an syntax error. Thank you for finding this bug. (I have another program on my Prime which exports a "BITS" function, essentially the same as "BitS" in the Sudoku program.) I you could tell which of my files you used on Windows I shall update my post with correct line encoding for Windows. /Lennart Börjeson Stockholm, Sweden |
|||
02-01-2015, 01:48 PM
(This post was last modified: 02-01-2015 01:58 PM by Thomas_Sch.)
Post: #13
|
|||
|
|||
RE: Sudoku editor/Solver
(02-01-2015 01:26 PM)lenborje Wrote:(01-31-2015 04:14 PM)Thomas_Sch Wrote: Hello lenborje,Well, I guess guess I need some help here... Hello Lennart, Both of your files open fine in editors like notepad++, SciTe or jedit. In standard notepad (included in windows) the line breaks are missing. I'll add the text-File with the windows-line-endings for you (exported from program editor out of connectivity kit). If I re-transfer the program from Prime via connectivity kit to a folder (drag-and-drop), I will get a file with the ending .hpprgm . These are non-text files in windows. For comparison i add also this .hpprgm-File. If you are opening this file in an editor, you will see the difference. If I open the files from your zip, for example with notepad++, they open as native text files, therefore they should habe the file type .txt. Thomas |
|||
02-01-2015, 08:52 PM
(This post was last modified: 02-01-2015 09:26 PM by lenborje.)
Post: #14
|
|||
|
|||
RE: Sudoku editor/Solver
(02-01-2015 01:48 PM)Thomas_Sch Wrote: I'll add the text-File with the windows-line-endings for you (exported from program editor out of connectivity kit).Thank you, that was really helpful. I've been completely fooled by the libhpcalcs utility also giving the plain text-files the suffix ".hpprgm". I've now updated the attachments in the first post of this thread. /Lennart Börjeson Stockholm, Sweden |
|||
02-02-2015, 08:12 AM
(This post was last modified: 02-02-2015 08:12 AM by Thomas_Sch.)
Post: #15
|
|||
|
|||
RE: Sudoku editor/Solver
Many thanks for your great program!
Besides solving sudoku it will solve also many questions about programming the prime with PPL. Thomas |
|||
02-02-2015, 08:33 AM
Post: #16
|
|||
|
|||
RE: Sudoku editor/Solver
There are two kinds of .hpprgm files: those with binary header before the UTF-16LE text, and those without
|
|||
12-20-2016, 03:37 PM
Post: #17
|
|||
|
|||
RE: Sudoku editor/Solver
Hi Lennart
thanks for the nice app. I recently stumbled across this app, as I needed a Sudoku solver. However this program errors out with the current firmware (10637) because UNION and DoSolve are now built in functions. UNION does what your sub-routine does, but DoSolve now is related to the Triangle Solver App. Solution: delete the declarations for Union or comment them out, Rename DoSolve to i.e DoSolveS. I could have posted the changed source myself, but I think it's better to leave it in your hands. Günter |
|||
12-20-2016, 03:40 PM
Post: #18
|
|||
|
|||
RE: Sudoku editor/Solver
Thank you for the heads-up. Unfortunately, I've been unable to upgrade my Prime since I moved to Mac on my desktop...
I'll see if I can borrow some time on a PC and upgrade, and then I'll update the Sudoku solver. /Lennart Börjeson Stockholm, Sweden |
|||
12-20-2016, 04:11 PM
(This post was last modified: 12-20-2016 04:17 PM by Guenter Schink.)
Post: #19
|
|||
|
|||
RE: Sudoku editor/Solver
(12-20-2016 03:40 PM)lenborje Wrote: Thank you for the heads-up. Unfortunately, I've been unable to upgrade my Prime since I moved to Mac on my desktop...I see. The Sudoku_temp.txt is a version that has the proposed changes. I'll delete the file once you were able to do the corrections yourself. Not necessary to have various versions floating around. Originally I got your program from hpcalc.org which is an older version. Did you commit your latest version already to Eric? Regards, Günter Edit Replaced .txt by .zip |
|||
12-20-2016, 07:35 PM
Post: #20
|
|||
|
|||
RE: Sudoku editor/Solver
Quote:I've been unable to upgrade my Prime since I moved to Mac on my desktopWouldn't the brand-new CK for MacOS X (current version: http://www.hpmuseum.org/forum/thread-7420.html ) be an option for you ? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)