Python Projects

Here are some Python projects that I have made for fun.

Collect the Keys

This is a game where you control a man who is running around a maze trying to collect as many keys as possible. Beware though because there are zombies in the maze who will try and catch you! Arrow keys to move around. Enter key to restart the game when you die.

This program uses a nice recursive method to compute which squares of the maze are visible from your current position, and some simple finite state machine ai on the zombies. Requires the Pygame package to render the sprites.
Code only. ZIP file with code and sprites to play the game.

Run for your life!

AI Connect Four

A simple AI for the game Connect Four. It uses an alpha-beta search and a simple evaluation function that counts "sequences" of like colored pieces in a row. Its actually pretty decent: will beat me ~50% of the time. Works in the terminal without pygame and displays "nice" graphics if you have pygame.

Martian Dice Strategy Calculator

A program that uses the dynamic programming principle to calculate the optimal strategy in the dice game Martian Dice (PDF explaining the rules here.) The code right now plays an example game and shows you the expected score one gets depening on what choices you make.

TV Character Tropes Scraper

This program uses the Beautiful Soup package to scrape the TV Tropes website and extract a list of characters with their corresponding tropes. These are stored in a python pickle file to make accessing them in python super easy. This can be used for example as part of an automatic character generator which combines tropes from characters that are similar. An example application is included.
Scraper code.
Example application.
Pickle File 1 .
Pickle File 2 .

Clustering Movie's by their MovieDB tags

Using data from the MovieLens "tag-genome" project , this program applies a fuzzy clustering algorithm to group similar movies. (User tags are things like "action", "sci-fi" and but also things like "atmospheric", "thought-provoking", "realistic".) This is part of project to make a movie recommednation system based on what "type" of movie you are in the mood for (e.g. are you more in the mood for something like "The Matrix" or something like "Ferris Bueller's Day Off"?) The raw data files this reads can be downloaded directly from the MovieLens group here .

Here is the type of output it gives (here outputting the 5 movies in each cluster that most fit that cluster):
Movie Clusters