Sep 22 2016

Board Games and Computer Science

Published by at 2:10 pm under faculty and tagged: ,

I really enjoy playing board games. Not luck based games such as Monopoly or Risk, but games that require a well-executed strategy. My favorite board game is Maharaja. The idea is to move your architect along the cheapest routes to visit cities and to build palaces. The first player to build all seven palaces wins. Finding the cheapest route to a city depends on where you have already placed houses and on where you can build or move houses on your turn. This is a shortest path problem that must
consider all the different house configurations that can be created during the player’s turn, selecting and utilizing the cheapest one. Writing a competent AI for this game appeared a manageable task as it required a Graph data structure with Dijkstra’s shortest path algorithm. Maharaja became the first board game that I turned into a computer game, complete with networking for multiple human players. It was not uncommon for me to think that there was a bug in the game when I couldn’t figure out the path that the AI used and spent so little money on. After staring at the board awhile, I could always find the roundabout route that the AI found, which I might never have seen as a player. maharaja

What I realized after I finished the computerized Maharaja was all the interesting classes that it required. I teach the Object-Oriented Programming (CSC 2120) course frequently, and it is very challenging to create good programming questions for exams. OO is easily the most difficult class for me in terms of writing exam questions. However, I now had a virtually unlimited source of ideas as I own over 100 board games (and have played many, many, more). Each game is a potential source for interesting classes and data structures. Although OO exams are still not easy to write (as many of these cool classes are too difficult for an exam), I have used ideas from several different games including Amyitis and Endeavor, for which I have also written computerized versions. I am working on an OO exam right now, and am using my newest game for inspiration.

endeavor

During the fall 2015 semester, I decided to computerize Brass, a game which I hated the first time I played it (and paid around $60 for). Eventually, I decided it was a great game. After completing Brass, not only did I have more material for exams, but I realized that many (nearly all) of the design patterns that we discuss in OO were present in the Brass implementation in some way. I decided that it was time to write a series of labs that slowly implement the Brass game. I got good feedback from the spring 2016 class. They enjoyed using a GUI and the mouse rather than a console application and the keyboard. One thing that I did not like was the fact that at the end of the last lab, the class did not have a fully functional game. I corrected this over the summer, so the labs for the fall 2016 class will end with a complete game that includes AI and networking. Not every Brass feature will be implemented during the labs, but the majority will be. I am hoping that this will make the labs fun for both the students and myself.

amyitis

One response so far




One Response to “Board Games and Computer Science”

  1.   Cannon Ruthon 23 Sep 2016 at 7:34 am

    I think real world applications like this are really fun. I come from a background with very little computing experience, and having something like this to apply what you’ve learned is a great aid. Cool article!