I’ve been learning a lot about Python over the last year but I realized a few weeks back that I needed some more intensive time with it to get really fluent. That’s when I came up with 30 days of python. I’m going to make a small project every day in python for the next 30 days (probably a few days longer since there are some vacation days in there). I’m hoping to learn a bunch of different python packages and make a wide variety of projects from games, to computer tools, to machine learning, and maybe some science. It should be a good variety and I think it will be a lot of fun.
Day 1: The fifteen tile puzzle
Back in the fall last year, I took a class on interactive python where we coded in a web interface that had a module called
simplegui for making the window, buttons, and canvas. Everything else was pretty standard python. I wanted to port some of the games I made back then to
pygame so I wouldn’t need the website to play them. The first one I ported is a take on a puzzle game that I got from restoration hardware a long time ago. There are 15 tiles in a 4×4 grid and the goal is to rearrange them in a pattern. It can be fun to try and find new patterns to create with odds and evens or just to try and get it back to its original configuration.
I used this tutorial as a starting point for porting it over and getting
simplegui functionality in
pygame. I quickly realized that I could minimize the changes to my existing code by making classes to replace the ones from
simplegui (frame, canvas, button). Maybe a later project will be refactoring the games I port to use
pygame more directly. I like the way the main canvas turned out and the tiles actually move from one place to the next but the buttons and button panel still need a lot of improvement.
For those who are interested here’s my github repo for the games project: https://github.com/robb07/python_games