Thursday, 10 November 2011



X| | 
 | |O

Lessons in Life – universal
Computer Science – A-level/undergraduate level

There can be few better exhortations to students than this. Working hard and doing one’s best will always produce the finest possible results, either in the classroom or on the playing field. After any exam or sporting challenge there is no failure if one can say afterwards “I did my best”. (England footballers please take note.)

A game of noughts and crosses is underway on the blackboard. If this has been done by a student then it should have been rubbed off immediately (see post #9 re Wilson and Kelling’s broken windows theory). But if this is actually part of the lesson then a gold star should be awarded as noughts and crosses is a great introduction to many mathematical and computer science concepts from combinations and symmetry to artificial intelligence.

A first question to pose to the class would be how many games of noughts and crosses are possible (the game tree size)? A naive answer would be 9! = 362,880 (assuming X always goes first). However, many games will be over before all the squares are filled, and many more are simply rotations and reflections of others (in effect there are not nine, but only three starting places: corner, centre and edge). Taking these into account gives an answer of 26,830.

Devising an algorithm to produce perfect play is also a favourite challenge, exploring ideas such as backwards reasoning and recursion. These can then be applied to other, more complex games such as Connect 4 and draughts, through to unsolved games such as Reversi, chess and Go (with its game tree complexity of 10360).

However, if this is an attempt to teach the strategy of perfect play then one must hope that the teacher has picked a very poorly-played game to illustrate what not to do. Assuming that X’s first move was in the corner (always the best start: of the then 73 possible games, assuming perfect play on X’s part, 71 result in victory and two in a draw), then O has immediately blundered by playing the far edge instead of the centre (where his/her only hope of a draw can come from), resulting in what should be certain victory for X. X could then force a win by playing the centre, but has him/herself blundered by playing middle bottom. O can now snatch a draw from the jaws of defeat by playing centre or top right, leaving X to harp on about how the Wags should have been allowed to stay in the team hotel.

Despites its pedagogical pedigree, noughts and crosses quickly becomes futile when both players can easily force a draw. This was well-illustrated in WarGames, when the military supercomputer, equating the game to global thermonuclear war, evaluated all possible outcomes and remarked, “Strange game. The only winning move is not to play.” Failing that, just work hard and do your best.

8/10 An inspired choice of teaching material.


  1. There are four books over the desktop. The top one is El Padrino (spanish version of The Godfather by Mario Puzo) and the last one is El Cuerpo (may be the spanish version of The Body by Stephen King).

    Perhaps the schools is from Latin America (hopefully not far from my house) and "Work hard and do your best" is part of the english lesson!

    Greetings from Argentina :)

    1. wow good post. I also have interesting articles. visit my blog yes click here

  2. Presumably, the skull is from a student who didn't work hard and do their best, or was unable to master the final game of Tic-Tac-Toe.

  3. How about telling us the name of the film in these posts?

    Just for completeness sake, of course.

  4. it's from SG's "Back to school" set.

  5. apparently, she was teaching spanish

  6. Do you like Asian pornstars? I quess "yes". Visit my blog black on asian free adult pages and read the article Mia Khalifa real name.You also may like livesex chat with online cam girls. Thank you so much for reading my comment!