The Mathematica Journal
Volume 10, Issue 2


In This Issue
In and Out
Trott's Corner
Beyond Sudoku
New Products
New Publications
News Bulletins
New Resources

Download This Issue 

About the Journal
Editorial Policy
Staff and Contributors
Back Issues
Contact Information

Exploring Board Game Strategies
Yves Papegay


Chess, backgammon, Abalone, Go, Tic-Tac-Toe, Mine Sweeper, Tetris, and many others are well-known examples in the large collection of so-called board games [1]. Board games provide many interesting topics of study for several academic disciplines, which have their own scientific societies and journals [2]. Board games are also very popular among freeware and shareware users. There are many ways to play against a machine, running the code online as an applet or servlet, or on a personal computer, a PDA, or even a mobile phone.

Developing a computerized version of a board game is an exciting challenge and a very good exercise for computer science students. From the theoretical point of view, the implementation of the evolution of a game usually involves a wide range of classical algorithms as well as implementation of the strategies played by the computer. It is also important to keep in mind that the fun derived from playing a game often critically relies on a nicely designed and efficient user interface.

Incorporating different kinds of programming paradigms, Mathematica [3] embeds a highly flexible and intuitive language for prototyping applications. Using a computational environment such as a development platform allows for a generic and high-level representation of the board and its evolution. It also makes development and testing of board game strategies easier.

The notebook environment is powerful enough to set up the interface between the game and the player and offers a good visualization of the board. However, even with careful and sophisticated development the graphics are not fancy enough to be addictive to players. Fortunately, with the help of Java toolkits, namely J/Link and GUIKit, the functionalities of Abstract Window Toolkit (AWT) and Swing [4] are within reach and permit the dream of an interface being developed with only a small effort.

In the first part of this article, we describe a generic design pattern for the implementation of board games. Actually such a game is uniquely and completely defined by a quite small set of information concerning the representation of the board, the playing rules, the initialization phase, and the termination phase. From this set of information and with the help of the generic design pattern, we can quickly develop a playable and smart implementation of the game.

Examples of such developments are given in the second part of the article where we describe in detail the full playable implementation of

1. HMaki--a Japanese puzzle game (a.k.a. Same Gnome by Linux users)

2. a classical lines game

3. Mancala--a well-known African game (a.k.a. Awale)

For each of these examples, we also provide a tutorial approach to the development of a fancy graphical user interface using Java technology with the help of J/Link and GUIKit.

The last part of the article is devoted to the exploration of strategies. One benefit of developing our own implementation of a board game with Mathematica is that it yields perfect control over the different steps of each game, the ability to unplay or to replay some or all of those steps, to add or remove randomness, and to add or remove interactivity during the game. Mathematica also makes it easier to implement and apply strategies and perform, on a large set of examples, statistical analysis on the resulting games.

About Mathematica | Download Mathematica Player 
© Wolfram Media, Inc. All rights reserved.