Games I made in a Python class: play them

A few weeks ago I finished my third free online Coursera course: An Introduction to Interactive Programming in Python.

I enjoyed it a great deal. I used to do a lot of programming, but it’s been a long time. I’d never done Python before but didn’t find it a difficult language to get my head around.

It was challenging, though. They covered a lot in the video lectures in each of the 8 weeks, moving very quickly through topics. There were quizzes and programming assignments every week. The amount and depth of work for a free course was considerable.

It focused on interactive programs – that is, games you can play – which was sort of new for me. It was also my first foray into object-oriented programming, which is well-suited for games. This was a challenging change of mindset at first but by the end I really got into it.

We created all our games in an online tool so that we could submit them for peer gaming. You can play the games I created, if you like. Here are a couple of the later ones. After clicking each link you’ll get a screen with the code on it; click the Run button (the one in the upper left with the little arrow) to play the game. Note that these probably won’t work in Internet Explorer, but they should work in Chrome, Firefox, or probably Safari.

Pong. Yep, the game with the two paddles and the bouncy ball. This is made for two players. The player on the left uses the W and S keys to move their paddle up and down; the player on the right uses the Up and Down arrow keys to move theirs. Note that we didn’t implement complicated bounces off the corners of the paddles; the ball either bounces back if it hits the front of the paddle or counts as a miss. There’s a  button to let you restart the game and score.

Memory. This is a single-player game where you turn over two cards at a time by clicking on them with the mouse. If the two you pick match they stay turned over; if they don’t they flip back when you click the next card. The object is to try to match them all in as few clicks as you can. Again, there’s a restart button.

Blackjack. A simple version of the classic card game. A single player plays against a dealer. You can hit (get an additional card) or stand (let the dealer take some); the winner is the closest to 21 without busting (going over). Dealer wins ties, and hits as long as he’s showing less than 16. After a game finishes, hit the Deal button for a new game.

RiceRocks. A simple version of the classic arcade game Asteroids. This one took us two weeks. Single player, but with fancy images and sound (which the course supplied). Use the Left and Right arrow keys to rotate your ship, use the Up arrow key to thrust forward, and the Space bar to shoot. You have three lives. Sorry, no hyperspace or flying saucers. After playing you’ll need to hit the Reset button on the code screen (the back arrow, the last button) or close the browser tab to make the sound stop. Sorry.

There’s a lot of geeky enjoyment built into these games. Enjoy.

RiceRocks

Another Cousera course: Python

I just can’t stop taking Coursera classes. I mean, they’re free. Who doesn’t like to learn for free?

Well, you might not all like to spend your few spare hours learning a new computer programming language but that’s what I’m doing this time. I’m a couple of weeks into An Introduction to Interactive Programming in Python, and have already done two quizzes and submitted an assignment. It’s been a long time since I did proper programming but I’m really enjoying this so far.

It’s wonderfully geeky too. Our first, very simple, project involved this:

shrubbery_212

 

The second, more involved, program involved this: