SudokuDemo.wx.py
About a week later than I had hoped I've finally managed to finish the Sudoku demo from ClipsJNI. I've tried staying as close to the Java version as possible but there are a few differences. For example, I've added an Open File-button that allows you to load a puzzle from a text file. I've included a few sample puzzles in the zip. The format of the puzzle must be exactly as in the examples: 9 lines of 9 characters (and a newline) each. Characters "1", "2", "3" to "9" are added as-is, all other characters are "added" as blanks (I use "0" in my examples).
I've still got some work to do before I upload this as a pyClips example on SourceForge. I really want to clean up the code and try to make it as easy to understand as possible. I also intend to write a short introduction to using wxPython and pyClips together.
The code is here if you want to have a premature look. If you find any bugs or peculiar behaviour please let me know. Enjoy!
4 kommentarer:
Beautiful...
...and it takes less to load than its Java counterpart! ;-)
Even though I'm in deep water with that unicode thingy (see the RFE comment), I must say that you've done a great job translating the ClipsJNI examples.
The release package I prepared for the examples is... (guess it) pyclips-examples. It doesn't show up now in the file releases page because there are no files in it yet, but it should accept new files.
Thank you again,
F.
The release package I prepared for the examples is... (guess it) pyclips-examples. It doesn't show up now in the file releases page because there are no files in it yet, but it should accept new files.
Brilliant, I'll hopefully have a file ready by the end of this week.
Any thoughts on code layout or commenting? I think I'll try to make it as similar (structure-wise) to ClipsJNI as possible and keep all, or at least most, of the comments for easy comparison.
The Python code is well structured in my opinion, I don't know how useful it is to comment wxPython applications because in most cases the code is rather self explanatory. Also, the CLIPS code is identical to the ClipsJNI example: I think, as you do, that it's good to keep the examples as close as possible to the Java based ones, so there would be no reason to add more comments to the CLIPS code.
Maybe, we can also add a page for each example to the new PyCLIPS home page, with a brief explanation on how the applications were developed, for instance how the RC editor was used and why the application code uses certain techniques instead of others (for instance: we could explain that to use specific functions, like find-fact or find-all-facts, the clips.Eval() call is the easiest solution). In the new site there is a specific content type for this purpose, that should allow classification of examples.
I think that it would be nice to add a file containing the license in the packages. If, as you said, BSD is good for you, you can just create a license.txt file containing the integral license text. In my opinion this is the closest thing to Gary's original license that allows to correctly attribute the code. Also, the original work should be mentioned somehow.
F.
Thank you Johan for your incredable job to make life easier for those beginers like me. Keep it up.
Dereje
Skicka en kommentar