Category Archives: Python

Screenshots

Today sees the submission of my first real iPhone app to Apple. (We’ll have to wait and see how the approval process goes.) It took some time to push it over the finish line, so today I offer you only … Continue reading

Posted in iPhone, Python | Comments Off

Generalized Subtraction and Division

KenKen puzzles, as popularized in the U.S., have a major simplifying restriction: Subtraction and division cages must have exactly two cells. This restriction is lifted in some puzzle variants. Today, in response to a reader question, I briefly look at … Continue reading

Posted in Projects, Python, Web stuff | Comments Off

WordPress Backups (con’t)

This is a quick addenda to yesterday’s notes on backing up self-hosted WordPress blogs. I noticed that I neglected to make the scripts I described available as downloads, and that I didn’t illustrate the final piece of the puzzle: a … Continue reading

Posted in Projects, Python, UNIX, Web stuff | Comments Off

WordPress Backups

If you run a self-hosted WordPress Blog, it’s probably a good idea to back it up now and again. Here I present some code that I use to back up my blog to Amazon’s S3 service, which might help you … Continue reading

Posted in Projects, Python, UNIX, Web stuff | Comments Off

KenKen Solver – Multiple Solutions

A reader asks if the KenKen solver we recently developed can handle puzzles with multiple solutions. It turns out to be pretty simple to modify the search-and-propagation algorithm to return all the solutions to a puzzle, instead of just one.

Posted in Projects, Python | Comments Off

Overspecialized Constructors

I want to discuss a simple mistake which recently caused me a disproportionate amount of trouble. I believe I violated a simple rule which might be formulated as “do not create overly specialized constructors in languages which lack constructor overloading“.

Posted in Python, The Hard Way | Comments Off

KenKen Solver: Online!

I ported the Python KenKen solver I was playing with last week over to JavaScript, and wrapped a GUI around it. You can check out the resulting web-based KenKen solver, if you’re interested.

Posted in Projects, Python | Comments Off

Tuples Are Slow

Python tuples (immutable sequences) can be much slower to work with than their mutable cousins, lists. This surprised me; I would have thought they would have been faster all ’round, as they seem “simpler”. That doesn’t seem to be the … Continue reading

Posted in Python | Comments Off

A Neat Hack

I admit to being unreasonably pleased with the following trick: The KenKen solver we’ve built and tuned can be generalized to solve Sudoku, including jigsaw Sudoku, with a 9-character change to its source code.

Posted in Projects, Python | Comments Off

Python Performance Tuning (con’t)

Let’s wrap up our hunt for performance improvements in our KenKen puzzle solver. This sort of thing can go on nearly endlessly, of course, but after today I think we’ll have gotten most of the easy stuff, and seen dramatic … Continue reading

Posted in Projects, Python | Comments Off