Year: 2012

Disclosure: I sell a couple books that teach programming to kids (and are free to download). I don't personally view them as being in competition with Hackety Hack, but someone else might.

Hackety Hack was a project originally started by _why the lucky stiff to teach kids programming in Ruby. It often comes up in "I want to teach my kid programming" forum threads. So I downloaded Hackety Hack and decided to give it a try.

I found Hackety Hack to be frustrating and was very unimpressed with it, and do not recommend it as a way to teach programming to a beginner.

I've created Python & Pygame script that lets you walk around the overworld map of the original Legend of Zelda game on the 8-bit Nintendo. There are no monsters or levels or items; it is simply a walking tour. The Link walking sprite animation is implemented by my Pyganim module.

More importantly, this program does provide the raw map data the entire world map (something I haven't been able to find on the web.) Getting this from the Zelda ROM is actually a pain due to the tricks used to store the map info. The game doesn't store individual tiles and their XY location, but rather have one of three color schemes for the border and a color scheme for the center tiles. Even then, the game only stores columns of tiles, and then each room references which columns it uses. (You can notice the same columns being used in different rooms, even though their color scheme may change.)

These tricks aren't really needed with today's computers for a game as simple as Zelda, so I've compiled the tile map data for each individual location on the map. Here's the world map data file (it is also included in the main download below.)

This tutorial outlines how to create a tournament simulation program for the Zombie Dice game in Python. With this tournament program, you can also code your own AI bots to play Zombie Dice against each other. You can quickly test out how the different strategies the bots use compare against each other over thousands of simulated games. This tutorial assumes you know basic Python programming. (You can learn to program from the free book on this site, "Invent Your Own Computer Games with Python".

Computer game simulations make for great science fair experiments, and since the rules to Zombie Dice are so simple it's fairly easy to program a simulation for it.

The Rules of Zombie Dice

Zombie Dice is a dice rolling game that is fun for groups, quick to play, and can be learned in a couple minutes. It has a "push your luck" game mechanic.

Each of the players is a zombie. Each of the dice represents a human victim. You want to eat brains and avoid shotgun blasts. If the footsteps come up, the human has eluded you. The rules are summarized below: (Or view the official rules PDF or view the Flash tutorial.)

Pygame is a 2D graphics and gaming library for Python. It's pretty nifty because it essentially gives you a blank window that you can draw any shapes or lines or images you want on it. But it doesn't come with any UI elements like buttons, scrollbars, or check boxes. This post will go through not only creating a button class for Pygame, but also the reasoning behind why I've set up the code as it is. This is more of a "how to create a module other people can use" tutorial than a UI or Pygame tutorial.

This tutorial assumes you know the basics of Pygame and Python programming. If you don't, it's probably easy enough to follow anyway.

A button is a common user interface (UI) control that is used in many software applications. It seems simple enough: there's a button on the window and you click on it and something happens. But there's a lot of details we should plan out ahead of time. Remember, we want to make a generic button class so that other programmers can use this in their games and programs. Once you've read through the process here, you'll be familiar with how to make your own modules for UI elements.

Designing a UI button class is good a good programming practice exercise.

Download the PygButton module from PyPI by running "pip install pygbutton". You can also look at just the pygbutton.py file itself.

I have no idea how old you, the reader, are but that's irrelevant. No, you are not too old to learn programming. If you wonder if you are too old to become a professional software developer and are under the age of 50, the answer is still no. (And even above that age, the answer is merely "probably".)

But you might feel too old, or at least feel forever crippled because you didn't start coding the instant you developed fine motor skills. But I still assure you: You are not too old to learn programming.

I have the source code written for my next book, "Hacking Secret Ciphers with Python" (formerly "Become a Code Breaker with Python"). (You can download the rough draft.)

The programs all implement classic cryptographic ciphers (Caesar cipher, simple substitution, etc.) as well as programs that can crack them. I'm posting it for public review so people can make any suggestions for edits. The code is loaded on github here:

These programs are for a book that teaches computer programming in Python 3 to complete beginners, as well as teaching amateur cryptography. My aim for the programs are:

Simple - Is the code arranged in a way that requires the least amount of prerequisite knowledge? Is there a chunk of code that should have more comments? Is there a comment that doesn't make sense?

Correctness - Is the cipher implemented correctly according to descriptions of the cipher?

Consistency - Is the naming and spacing of the code consistent with the other programs?

Things that are not goals for the source:

Security is not a primary concern. These are educational examples to teach basic cryptography concepts. Please withhold comments or criticisms that would be more appropriate for commercial encryption software. I understand that Python's random module is not suitable for crypto. I understand that the RSA block cipher should use CBC mode instead of ECB mode. These decisions have been made because the point of this book is to teach and be simple for the reader to understand without going into the arcana of cryptography.

Efficient and elegant code is also not a primary concern. For example, I don't use list comprehensions because it would add another programming topic to explain in the book. The code uses more lines than it probably needs too, but I'd rather have more-but-readable code than less-but-elegant code. If there's an order of magnitude improvement that I can make, I'll do it. Otherwise, a few extra seconds of processing time is worth having simpler code.