"Hacking Secret Ciphers with Python" Released
Posted by Al Sweigart in news
My third book, Hacking Secret Ciphers with Python, is finished.
Writings from the author of Automate the Boring Stuff.
Posted by Al Sweigart in news
My third book, Hacking Secret Ciphers with Python, is finished.
Posted by Al Sweigart in pygame
Posted by Al Sweigart in programming
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.
Posted by Al Sweigart in pygame
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.
Posted by Al Sweigart in python
Posted by Al Sweigart in pygame
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.
Posted by Al Sweigart in programming
Posted by Al Sweigart in programming
"Zip" programs that can compress multiple files into one smaller .zip file are fairly popular for downloads since the fewer bytes you have to download the faster it will download. But how do you compress files? Files are made up of ones and zeros, which can't be squished like clothes into a tight suitcase.
Posted by Al Sweigart in python
This is a continuation from Part 1 and Part 2, where I go through the source code of Square Shooter, an Asteroids clone, and try to redesign the code to be more readable.
Posted by Al Sweigart in python
This is a continuation from Part 1, where I go through the source code of Square Shooter, an Asteroids clone, and try to redesign the code to be more readable.
Posted by Al Sweigart in python
In this blog post, I'm taking a game off of Pygame.org and going through it to make it more readable and extend its functionality. You'll see an example of how to take code that works and changes to improve it's design (but more importantly, I explain why I make those changes).
Posted by Al Sweigart in python
If you need an idea for a game, try this random game mechanic generator.
Posted by Al Sweigart in pygame
Posted by Al Sweigart in python
Figuring out what Python's error messages mean can be kind of tricky when you are first learning the language. Here's a list of common errors that result in runtime error messages which will crash your program.
Posted by Al Sweigart in programming
True is the opposite of false. Up is the opposite of down. What is the opposite of dog?
Posted by Al Sweigart in teaching
Posted by Al Sweigart in python
This post goes into the details of how you can add a "save game" feature to your Python games.
Posted by Al Sweigart in python
To figure out bugs in your code, you might put in print
statements/print()
calls to display the value of variables. Don’t do this. Use the Python logging
module.
Posted by Al Sweigart in python
I made a twitter bot that checks every hour for someone who has asked the question, “Why do homeless people have dogs?” and automatically replies, “Because a dog will love you even though you are homeless.”
Posted by Al Sweigart in programming
CircleMUD was a popular piece of server software for running a MUD, and it came with a sizeable virtual world (which the admin could modify/append to customize their fantasy world.) It would be pretty handy to use parts of this data if you were creating your own virtual world for a text adventure game, but the format of CircleMUD's data files is kind of obtuse and not amenable to manipulation.
So I wrote a few scripts to convert these files into a single XML file which is 4MB when unzipped. You can parse this file and modify it to suit your needs. It contains 1979 rooms across 30 different areas (called zones in the file), with 46 shops and 569 different "mobs" (mobile objects, which are the monsters and NPCs). There are 678 different types of objects, including 116 weapons and 154 types of armor.