List of Street Names, List of Last Names

I wrote some programs to go through 6 GB of OpenStreetMap data from http://metro.teczno.com so that I could extract a list of street names for an upcoming game project. The game will use procedural generation to create cities, so I need to have a dataset of street names but couldn't easily find one. So I've created this one and wanted to share it.

Download zip file of street names. (805 KB)

I did a lot of tweaking to remove duplicates. Each street name is on its own line, and you can just add "Rd", "St", "Ln", "Ave", "Blvd", "Pkwy" or any other suffix to the end of it. The zip file has a file of street names from each city, and then an allstreets.txt that has all of them combined into one file (with duplicates removed). Streets with numbers have been removed (there is no "7th" but there might be "Seventh").

The street data comes from Boston, Chicago, Leeds, London, Manchester, St. Paul, New York, Seattle, the San Francisco Bay Area, Sydney, and DC, so you can expect that they mostly have Anglo names.

Then after looking at the data for a while, I realized that these could also be used for Anglo last names. I've removed any words that appear in a dictionary file I have, so some common last names like "Smith" or "Hunting" won't show up. I would consider this list of moderate quality. Here's the list:

Download zip file of last names. (171 KB)

I can't vouch for the quality of the lists, but from a cursory inspection they seem quite serviceable. Enjoy!

Read More

Virtual Caesar Cipher Wheel program

The Caesar Cipher Wheel is a paper cutout that can be used to perform encryption and decryption in the Caesar Cipher. However, if you don't have a printer but do have Python and Pygame installed, you can use this Caesar Cipher Wheel program to rotate a virtual cipher disk instead.

Download source and image files. (88 KB)

Download the executable for Windows (5.3 MB)

There is also an online JavaScript Virtual Cipher Wheel.

You will need Python (2 or 3) and Pygame installed to run the program. Or, if you are running Windows, you can download the win32 binary.

Read More

New Game Source Code: Simon Gesture (Simon clone with mouse gestures)

This game works with Python 2 or 3, though you'll need the Pygame framework first. This game makes use of the MooseGesture mouse gestures module I developed.

Draw out horizontal, vertical, or diagonal lines in the same directions that the dot moves. The pattern of the dot's movement becomes longer and longer.

Source code & music file.

If you'd like to learn about how the mouse gesture algorithm in the moosegesture.py module works, look at the MooseGesture post

Read More

Pygcurse - A "curses" Emulator Built on Pygame

Pygcurse (pronounced "pig curse") is a curses library emulator that runs on top of the Pygame framework. It provides an easy way to create text adventures, roguelikes, and console-style applications. The mascot of Pygcurse is a blue pig with a skull tattoo on its butt.

Download Pygcurse and Demo Programs.

Read the Pygcurse tutorial.

View the Pygcurse homepage.

Pygcurse provides several benefits over normal text-based stdio programs:

  1. Color text and background.
  2. The ability to move the cursor and print text anywhere in the console window.
  3. The ability to make console apps that make use of the mouse.
  4. The ability to have programs respond to individual key presses, instead of waiting for the user to type an entire string and press enter (as is the case with input()/raw_input()).
  5. The ability to use any font and any character in those fonts.
  6. Since the console window that Pygcurse uses is just a Pygame surface object, additional drawing and transformations can be applied to it. Multiple surfaces can also be used in the same program.

Pygcurse also provides some additional features that curses normally doesn't, such as tinting, shadows, textboxes, and line drawing functions.

Pygcurse requires Pygame to be installed. Pygame can be downloaded from http://pygame.org. Pygcurse can be used with either Python 2 or Python 3.

Read More

Rough Drafts of Next Two Books Available

I've decided to make the incomplete rough drafts of my next two Python books available.

Become a Codebreaker with Python

Making Graphical Games with Pygame

The emphasis is on "rough" and "incomplete", but I thought it would be better to give a preview of the direction I was going. These books are also available under a Creative Commons BY-NC-SA license like the first "Invent with Python" book.

The Code Breaker book is aimed at complete beginners who have never programmed before, and as such has a lot of the same content as Invent with Python. It covers various encryption programs, and also how to write programs that can break encryption. (It's an intro to programming and cryptography at the same time.)

The Pygame book is aimed at people who have read the first book or have a moderate amount of Python experience, and want to learn how to use the Pygame library to make graphical games. So far, the book really only has the source code for the games that will be in the book (these are the same programs that have been featured on this blog before.)

Hope you enjoy them. Feel free to send any ideas on content or presentation to me (don't bother with typos and such, these are incomplete drafts and those are probably known issues.) [email protected]

 

 

 

 

 

Read More