Monday, March 21, 2011

The day my son subtracted

Alex is four years old. For his birthday, we got him Flea Circus, a fun little card game by Reiner Knizia whose main appeal may be the little plastic dogs and cats that are included. They are the scoring mechanism for the game: dogs are worth two points and cats are worth one. At the beginning of the game, they are grouped in the middle of the table, and as you get acts for your flea circus, you take your points from the middle or sometimes from other players.



The first time we played the game, we explained to Alex how the scoring worked. Points are earned in the 1-4 range, and every time Alex earned points, he would take the appropriate number of cats. Once the cats were all gone, he was visibly confused over the value of the dogs, and we had to "make change" for him.

We put the game away for several weeks, wondering if perhaps the mathematics of the scoring was just a bit over his head. The manufacturer's suggested age is 6+ after all, and the BGG suggested age range is 5–12. When we got it back out and played a few times, Alex did not make a run on cats. He seemed to notice the patterns in how my wife and I scored our points: one was a cat; two was a dog; three was a cat and a dog; and four was two dogs. It was great to see that he had gotten the pattern, partially because it meant there was less fiddling with those awkward, easily-tipped cats. However, his was not a functional arithmetic abstraction, as once we were out of dogs, he was confused about how to count out three points again.

Flea Circus is a fine game, but it's not as much fun as Kinder Bunnies, which we got Alex for Christmas and is his go-to game. We play this game a lot. In fact, we made a scorecard of which is the magic carrot each game since we started playing:


As you can see, we have played 46 times, and Gilligan has proven himself most often to be the magic carrot. (As in Killer Bunnies, the premise of the game is that you acquire carrots, not knowing until the end of the game which is the magic, game-winning one.)

Some of the Kinder Bunnies cards are Bunny Bucks. These are used to activate some other cards, although usually you just hoard them since ten will buy a carrot. Bunny bucks come in different denominations: 1, 2, 5, and 10.



One of the cards allows you to spend five bucks to retrieve and play any card from the discard pile—especially useful when the coveted Take Two Carrots card has been played! Alex had never previously shown any savvy for arithmetic with Bunny Bucks, although he could recognize that the "5" card was enough to use the buyback, and that the "10" card could be used to buy a carrot. Given mixed denominations, though, we always had to point out to him what he could do with it.

On Saturday, we were playing in a group of five with my wife's parents. Alex had four "1" Bunny Bucks in front of him, and he asked if he had enough to use the buyback card. I spread out his cards and pointed out that each was worth one, then asked him to count them, and he noted that he had four. "Oh, so I need one more," said he, nonchalantly. "Yes, that's right," I responded.

That was the day that my son subtracted.

Book Review: Little Wars

A friend recently lent me H. G. Wells' Little Wars. The book was published in 1913—hence its free availability on Project Gutenberg). As one can tell from the summary on Wikipedia, Little Wars provides a set of rules for miniature wargaming using toy soldiers and model cannons.

What fascinated me about this book was that it contains all of the elements of modern game analysis. He begins by describing the history of the game design, including the inspiration and the evolution of early rule sets. The finalized rules are not presented as cut from whole cloth as in a modern rulebook, but rather as the reasoned and balanced product of a disciplined iterative and incremental design process. That is, although Wells does not use this language, it is clear that he used design thinking as a formula for creating a fun game. A detailed session report is provided, and the entirety is given in-character as a commanding officer rather than the game's inventor: Wells didn't just see the game as a simulation but as an opportunity for role-playing as well.

There are a few places in the book that address gender roles in the early 20th century. Not being a scholar of such things, I do not know if this reflects Wells' sexism or the dominance of traditional gender roles at the time, though I suspect it is the latter. For example, the subtitle of the book is "a game for boys from twelve years of age to one hundred and fifty and for that more intelligent sort of girl who likes boys' games and books." Is the "more intelligent sort of girl" the one who likes boys' games or the one who fights cultural stereotypes to pursue her interests?


I do not know how much other work there was on game design in the 1910s, but I'd wager it was much less than what one can find at the local bookstore today. As an academic and as a "gamer," I would love to see more game design treatments like Wells'. It has a much different flavor than contemporary post-mortems, which tend to deal with lessons learned rather than the human-powered creative processes.


If you have any interest in critical game analysis, I recommend that you flip through Little Wars. The price is right, and it's an entertaining read, both in its own right and as a piece of game design history.

Thursday, March 10, 2011

Recruitment for the Virginia Ball Center, Spring 2012

(My proposal to the Virginia Ball Center for Creative Inquiry was recently approved, and so begins recruitment. What follows is the statement I will be spreading around campus in order to recruit students into the project. I welcome your feedback on the announcement itself, and I encourage you to share the announcement with any BSU undergraduates who might be interested.)


In Spring 2012, I will be mentoring a team at the Virginia Ball Center for Creative Inquiry (VBC) in a seminar entitled "Games and Learning: The Underground Railroad." We will be exploring the intersection of play and learning within the challenging context of American slavery. The team will work together to design and develop a game based on the Underground Railroad, a game that is both fun and educational, whose playing and enjoyment will result in a deeper understanding of the theme.

This is an ambitious student-driven project, and its success requires a team of talented and dedicated students. Game development requires creativity and interdisciplinary collaboration. We will need artists, writers, programmers, editors, marketers, managers, musicians, and researchers. The input of historians and anthropologists will be as important as that of designers and technologists.

Our community partner for this project is Conner Prairie Interactive History Park. We will also be visiting the Indiana State Museum, the Levi Coffin House, and the National Underground Railroad Freedom Center.

The VBC provides a unique experience in undergraduate education. It is the ultimate immersive learning experience: students spend the entire semester working together on this one project, meeting in the beautiful Kitselman Center off the main BSU campus. Students earn fifteen credits for participating in the VBC seminar, and the VBC staff and I will work with your major and minor departments to ensure that you continue making progress in your studies through your participation.

The application process involves completing a form and providing two letters of recommendation, with interviews following. Application instructions can be found online.

About the faculty mentor: I am an associate professor in the Computer Science department, and I have been researching game design and development with BSU students since Summer 2006. Our most ambitious project to date has been Morgan's Raid, a history education game for Indiana 4th-graders developed over three semesters. I am interested in software development, board games, computer games, and the science of teaching and learning. Much of my recent scholarship has been on what people learn by creating games, and I am excited to work with an interdisciplinary team at the VBC.

Friday, March 4, 2011

Morgan's Raid in the Indy Star

Yesterday's Indianapolis Star had a feature on our playtesting of Morgan's Raid at River Birch Elementary in Avon, Indiana.

Here's the link again, in case I was too subtle above. Don't make me write "Click me."

Tuesday, March 1, 2011

Unit testing Java's System.out output

This topic came up in CS222, and the resulting legwork may of value to others. I posted a similar message privately to the course discussion forum.


The problem is that the students are writing console applications, but we're also learning about the value of test-driven development. You can unit test console apps much more easily than GUI, but it requires a bit of I/O sleight-of-hand. Your application writes to System.out by definition, and so you need to be able to capture the program's output somehow. There is a System.setOut method that can be used to change where System.out.print* writes. This method requires a PrintStream, and so one solution is to wrap a ByteArrayOutputStream in a PrintStream.


Consider the following example:




public class Exemplar {

    public static void main(String[] args) {
        System.out.println("Num args: " + args.length);
    }
    
}


This program simply will prints the number of arguments sent on the command line. In Eclipse, you can specify the arguments through the Run Configurations dialog.


The unit test for this looks like the following:


import static org.junit.Assert.assertEquals;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import org.junit.Test;

public class ExemplarTest {
    @Test
    public void testMain() throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        System.setOut(new PrintStream(baos));
        Exemplar.main(new String[] { "foo" });
        baos.flush();
        String whatWasPrinted = new String(baos.toByteArray());
        String[] linesOfOutput = whatWasPrinted.split(//
                System.getProperty("line.separator"));
        assertEquals(1, linesOfOutput.length);
        assertEquals("Num args: 1", linesOfOutput[0]);
    }

}


There are three tricks here that may require elucidation.
  1. It's possible for a buffered IO class to cache its result in memory before writing it to a stream. This is a good thing, since writing to a stream is expensive and writing to memory is cheap. However, this can mean that the results you're expecting to see in your stream may not show up when you go looking for them. The call to baos.flush will flush the buffers to the stream so you know the content will be there when we go reading for it. In my opinion, it's not worth remembering exactly which classes require flushing: it's polite to just flush anyway.
  2. You can make a String out of a byte array. It's generally not a good idea due to character encoding complications. In this case, however, we know it's really character data in the array since we're putting it there ourselves via System.out.print commands.
  3. We would like this to be cross-platform, but different operating systems handle end-of-line characters differently. Java gives us a system property for divining this information, and so we can use this to split the String into multiple lines.

STEM Major Production vs. Job Availability

Later today, I am giving an invited talk on the value of programming to non-CS majors. As part of this, I am going to discuss the current and projected future landscapes for employment in Computer Science. I came across the following chart a few weeks ago in an insightful post by Mark Guzdial. He credits the chart itself to Eric Raymond and the data to 10-year trends published by the Bureau of Labor Statistics.


Refer to Guzdial's post for more discussion.