Saturday 22 December 2012

My Second Completed Course

Apologies, the titles are getting a bit samey. Maybe I'll be feeling a little more creative when I write my next post.

Anyway, this will be a post giving a brief summary of the second Coursera course I completed (An Introduction to Interactive Programming with Python) and some of my views of the course; a review as it were. This time, I'll try to be a little more brief. I won't go into the more general aspects of how Coursera courses run; if you want to read about that please take a look at my previous two posts (Part 1 and Part 2).

What's the course about?

This course was an introduction to programming in Python, using the idea of building simple video games. It taught us the basics of using Python to write event-driven, object-oriented code by getting students to build a new game every week.

This idea sounded daunting at first (I have quite a bit of programming experience in other languages, but I'd never built any games before) but after the first mini-project was completed I felt confident enough to get through all of the projects and finish with a nice version of the classic arcade game Asteroids.

The teaching of Python involved using a web-based development environment, created by the teaching team at Rice University, called CodeSkulptor. This was a really good platform to experiment with Python coding and is available to anyone. It also made submitting the mini-projects very easy, requiring you to simply submit a URL to your completed project. It is a very good system that I will certainly be keen to continue using to play with Python in future.

So, what games did I build? And how difficult were they to finish? Here is a short summary of each week's mini-project.

Week 1 - Rock-Paper-Scissors-Lizard-Spock

If you don't know the rules of this game, watch the video below:

This project involved coding the logic behind this game and having the computer play 5 games against the player. It was to be a very simple implementation, testing our ability to work with simple Python code and output results to the console. The template given for the project made everything easy to understand and made the whole project very straightforward. Overall, a nice easy introduction to the mini-projects, and my first game :)

Week 2 - Guess the Number

Guess the Number was a simple implementation of the Higher-Lower guessing game where you have to try and guess the number within a certain number of turns. This project involved us learning how to work with input boxes, buttons and local and global variables. Again, it was a very simple implementation that used the console to display results. It was quite easy to complete with the given template but did show an increase in complexity over the previous game.

Week 3 - Stopwatch: The Game

Sounds like fun, right? This game involved using the canvas to draw a stopwatch (just text), while the game was to try and stop the stopwatch on a whole second. This project was the first to move away from using the console to display outputs and focus on just using the canvas; a gateway to producing all those fancy games with their graphics and whatnot. It was also a good test of our event-driven programming skills, involving the use of a timer to keep track of the stopwatch. This was a bit of a leap from the previous weeks, but was nothing that was out of reach of anyone who had watched the videos and completed the quizzes. Once again, a very handy template was provided and the instructions of what to do for the project were clear and laid out everything that needed doing.

Week 4 - Pong

Now this was a project I was looking forward to doing. Pong is one of those classics: one of the first ever video games and, as it turns out, really quite easy to build. This project was a big leap from the previous week, involving drawing multiple objects, controlling some of them with the keyboard, and calculating collisions on the canvas. By following the instructions and the template though, it was pretty straightforward to create and boy, it felt good when I completed it and had produced my own implementation of the classic Pong.

Week 5 - Memory

Remember that game where you turn cards over trying to find matching pairs? No? This game probably isn't for you then. For everyone else, this week's project was that game, teaching us to deal with mouse inputs on the canvas and managing game states. The increase in complexity from last week to this week was a little less but there was still quite a bit of work to do. This project highlighted how important it is to test as much as possible. I thought I had tested every possible action and outcome but one of my peers in the assessment phase commented that they found a bug in the game that I had missed in my testing. It was something rare, but was still a bug, and I was grateful for the comment from my peer.

Week 6 - Blackjack

The biggest thing that we learned doing this game was how to use tiled images (I won't go into it here, you're probably bored of reading this post now anyway). This project involved a lot more work than the previous ones because of all the different things that were going on: dealing cards, displaying the cards correctly, keeping hand totals correct and checking game states, working out who won the hand. I was very pleased with my attempt and that I managed to get it done in one evening.

Week 7 - Spaceship from "RiceRocks" (Asteroids)

This was the start of the final game. The project involved creating the spaceship from Asteroids in their version "RiceRocks". This was a big leap from the other projects, it involved dealing with changeable velocity, wrapping around the screen, momentum and friction. The tutors gave good instructions for it and lots of help was available in the discussion forums. Although it appeared daunting, once you got over the initial hump of making the spaceship appear and move, everything else fell into place. I had a few minor issues that I spotted before submitting, thankfully, and overall produced a pretty good effort.

Week 8 - "RiceRocks" (Asteroids)

The final project, and easily the most complex. This one involved adding to the previous project (we could use our own or use the template provided, I went for the template) by including multiple asteroids and multiple missiles to destroy the asteroids. We had to handle all of the possible collisions and keep track of lives and score. The instructions still helped but didn't go too far in telling you what to do. We also had the opportunity to add a bit of animation with explosions for the asteroids; it wasn't part of the grading but I had a go at it anyway, and it worked :)

Final Thoughts

Completing the final project, and so completing the course was great. I felt like I had a good, solid foundation in programming with Python, and I felt a lot more confident about being able to create games. When it is broken down the way the course did, it is much easier to understand and is clear to see that games are actually quite straightforward to create if you think about it carefully.

I very much enjoyed this course and would strongly recommend it to anyone interested in learning to program. There were no prerequisites for the course; so no programming experience was necessary. I found my experience helped me to get the projects done a little quicker but I don't think the course would be impossible if you hadn't done any programming before. The quizzes were very good at testing our knowledge and made good use of text answers rather than just multiple choice answers, requiring us to do a bit more work, rather than pick the right answer. As also mentioned above, CodeSkulptor was great and a pleasure to use.

Finally, I'd like to say thanks to the tutors of the course, and I look forward to seeing what they offer in the future. They put on a fantastic course and ran it really well, well done guys.