![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
Sudoku Kindlet (GPL3)
Hi,
I'd like to introduce myself to this nice forum (where I've been lurking since the start of last December when I got my Kindle 3 Wifi) with a Kindlet :-) As I like to fiddle with my devices I was eager to learn how to program it. For a start (after giving up building a native toolchain, it was too boring) I resorted to learn about Kindlets. Well, I do not have KDK access, but nevertheless, the openly accessible documentation is growing. And I like to say thanks for the kapp rudimentary application published on the forum here. So if you like to just play Sudoku or need another app to see how things can be done, here it is: a Sudoku kindlet. And yes, I'm aware there are others available. For now, it can read .sdm databases (one line per 81 field sudoku puzzle). Use the menu to open a puzzle database file. You can find some on the web, e.g. here: http://www.sudocue.net/download.php The kindlet will tell you in the file dialogue the folder where to put them. In order to run the kindlet you need to prepare your devices developer keystore to accept the keys the kindlet is signed with. The corresponding developer.keystore file is attached to this posting. It's the one from the "kapp" demo kindlet published in the "how to write Kindlets" thread here. Probably you will want to run other kindlets too. In order to run kindlets signed with different keys, you will have to merge your keystores. You can merge keystores by issuing the following command on your desktop (the keytool application must be in the path): keytool -importkeystore -srckeystore developer-to-import.keystore -destkeystore developer.keystore The keystore must be put onto the device, _outside_ the area accessible while in USB storage mode. It goes at "/var/local/java/keystore/developer.keystore". You need to put the keystore there either by creating a fitting upgrade package (I did not do that yet) or by other means (I copied via scp, by means of USB networking, but Wifi would work as well). The kindlet itself just goes into the usual "documents" folder. Have fun with the kindlet and its source code. A few words on the source: it's a netbeans project but only needs "ant" to compile. Just issue "ant jar" and it will build and sign a jar file (you need to rename it to .azw2 suffix when copying). The automated signing will only work on POSIX (read: Linux) shells, though, Windows users might need to do that manually. Sources expect a folder "KDK" on the same level as the kindlet project basedir, containing a folder "lib", which itself should contain the jars from the device, as there are "Kindlet", "log4j", "json-simple", "xerces". You find the exact file names needed in the sources in the .properties file in the "lib" folder. Update, 2011-01-06, 15:10 UTC: fixed manifest to make it run, fixed bug in isSolved() and another note: You move the cursor with the direction keys, enter numbers with 0-9 if you have them, otherwise either the top row (qwer...) or the block qweasdzxc. You toggle between solving and notetaking with "m". Last edited by hawhill; 01-06-2011 at 01:38 PM. |
![]() |
![]() |
![]() |
#2 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 16
Karma: 2600
Join Date: Dec 2010
Device: kindle
|
When I compile this and install it, it fails with a crash.log entry saying that there's a failure due to Network-Access-Grants in the manifest. I took that out (does it use the network?) and it still failed. Any idea?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
Darn, that's my fault. I'll upload updated sources ASAP. For now, open the manifest.mf file and edit the network policy to "Sponsored", then recompile. I edited that after my last test (I intended to do another test on this) and totally forget about it. I'll give updated files in a few hours when I'm back home from work. I'll also try and make a screenshot then to show what you can expect.
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() ![]() ![]() ![]() ![]() ![]() Posts: 6
Karma: 590
Join Date: Dec 2010
Device: Kindle 3G
|
I think I spotted a little bug in the SudokoBoard code.
In the IsSolved method you call isColSolved twice, one of these calls should be to isRowSolved. |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
thank you, quite right, that's what you get for doing C&P too much :-)
The manifest fix as well as a fix for this bug should now be in the freshly-updated files. Sooner or later I should upload it to github or Google Code, I think. That will probably happen the coming weekend. I'd like to include some puzzles from the start and maybe link to a suitable pseudo-firmware-update file for including (or even better: appending to) the keystore. Also, a menu item for jumping to a specific puzzle within the current database would be handy, too. And in the longer run, it would be nice if the Kindlet remembers all solutions already done so you have proper state for all puzzles within a certain database. That would be database- and puzzle specific state storage. In the much longer run, some puzzle generators could be included. Maybe some open source code could be re-used for that. PS: I would be very fond of a public "experimental" developer.keystore that includes all currently known developer keystores and brings the possibility (by including the private key and publishing its password, such as has been done by the kapp-demo-kindlet author) to sign further software. That way we could have _one_ main entry point for users whishing to run custom, non-KDK (i.e. inofficially) built Kindlets. |
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 16
Karma: 2600
Join Date: Dec 2010
Device: kindle
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 16
Karma: 2600
Join Date: Dec 2010
Device: kindle
|
Working fine now thanks. It appears that when I recomplied with different manifest contents and scp'd them over to the kindle, it was somehow caching the old manifest or something until I cleared it all out and refreshed it.
Cheers. |
![]() |
![]() |
![]() |
#8 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
Yes, I noticed during development that you need to do a full framework restart to drop the cached manifest. That was when I was thinking about a proper title for the Kindlet :-) So when changing the manifest, you'll need a "/etc/init.d/framework restart" on the device. A full reboot will do, too.
|
![]() |
![]() |
![]() |
#9 | |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,016
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
Quote:
|
|
![]() |
![]() |
![]() |
#10 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
I use the one that comes with a regular JDK. In my case it's OpenJDK, here running on ArchLinux. But I certainly remember grabbing the description from somewhere on the web and it was not looking like it was OpenJDK specific but rather general JDK stuff...
|
![]() |
![]() |
![]() |
#11 |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,016
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
Thanks hawhil. After installing OpenJDK for Ubuntu (Sun's openjdk-6-jre to be specific) I could successfully merge the keystore per your exact instructions.
|
![]() |
![]() |
![]() |
#12 | |
Member
![]() Posts: 13
Karma: 10
Join Date: Feb 2011
Location: Albuquerque, NM
Device: Kindle 3G
|
keytool error
Quote:
I tried blank, and tried a few dummy passwords, but nothing worked. I got "keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect" So it seems like it wants a password, or the keystores each have a password? |
|
![]() |
![]() |
![]() |
#13 |
curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,016
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
|
I used "password" without quotes as password.
|
![]() |
![]() |
![]() |
#14 |
Member
![]() Posts: 13
Karma: 10
Join Date: Feb 2011
Location: Albuquerque, NM
Device: Kindle 3G
|
ah, that worked. thank you!
|
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,669
Karma: 2300001
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
|
Sources for puzzles
If you want to skip the puzzle creation there are several good puzzle collections available online (most of them concentrate on hard puzzles). Some examples: http://people.csse.uwa.edu.au/gordon/sudokumin.php Gordon Royle's puzzles with only 17 clues (see the link section). Most puzzles are not very hard. http://www.setbb.com/sudoku/viewtopi...&mforum=sudoku Wapati's hard puzzles (no chains needed). http://www.sudoku.com/boards/viewtopic.php?t=6291 The Patterns Game Results: Contain puzzles with various degrees of difficuly that all have the same initial shape. The last figure on each puzzle line is the rating according to Sudoku Explainer. http://www.setbb.com/sudoku/viewtopi...&mforum=sudoku Tarek's "Pearly6000" (very hard). http://www.sudokuvault.com/top50000.zip Ruud's top50000 (most are really hard). http://www.sudocue.net/top10000.sdm A subset of the top50000 (contains only the hardest puzzles from the larger list). http://magictour.free.fr/top1465 The top1465, another great list with really hard puzzles. source:http://hodoku.sourceforge.net/en/docs_cre.php Last edited by thomass; 04-24-2011 at 11:10 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
KindleTERM - a SSH client kindlet | vdp | Kindle Developer's Corner | 118 | 09-13-2015 10:34 AM |
Snake game kindlet | anmipo | Kindle Developer's Corner | 6 | 04-26-2011 01:09 AM |
Working kindlet development without the KDK | adq | Kindle Developer's Corner | 16 | 02-03-2011 08:44 PM |
GPL2 vs GPL3 licensing issues | AZed | News | 6 | 02-13-2009 04:40 PM |
Multiplayer Sudoku: Sudoku Combat! | PostGrant | Lounge | 1 | 06-20-2006 06:14 AM |