babylon: An implementation of a simple 2-player board game

[ game, program ] [ Propose Tags ]

The board game was originally designed by Bruno Faidutti ( In this implementation you play against the computer.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS] 0.1, 0.2, 0.3
Dependencies array, base (>=3 && <5), containers, random, wx (>=0.11), wxcore (>=0.11) [details]
License LicenseRef-GPL
Copyright (c) 2009 Pedro Vasconcelos
Author Pedro Vasconcelos <>
Maintainer Pedro Vasconcelos <>
Category Game
Uploaded by PedroVasconcelos at 2014-06-26T12:49:47Z
Reverse Dependencies 1 direct, 0 indirect [details]
Executables babylon
Downloads 3456 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2015-12-10 [all 10 reports]

Readme for babylon-0.3

[back to package description]

This is an implementation of a simple two-player game
in Haskell using the wxWidgets GUI toolkit.
This program allows you to play against the computer plays using
the classical minimax algorithm with alpha-beta prunning
(based on Bird and Wadler's presentation in the "Introduction
to Functional Programming").

The rules of the game are very simple: 
* there are 12 stone tablets in 4 colors (3 of each color)
* initially the stones are randomly placed on the table,
  forming twelve 1-stone piles
* on his/her turn, a player moves one pile ontop of another
  provided that they have the same height or the same top 
  color (or both)
* the first player who cannot perform a move loses the game.

The game play very fast, typically under 5 mins; since there
are only 12 piles at the start, and each turn decrements one 
pile, the game must finish in at most 11 moves.

Note that there is a winning strategy for the second player, but
it does not appear to be a simple heuristic for it (?). 
The computer will play the winning strategy at the hardest level, 
so it will always win as a second player at this level.

This was basically programmed in a single day as an experiment 
using this wxWidgets (though I was experienced with Haskell). 
I thought it would be a nice addition to show a simple but real
Haskell program.

If you have any comments please drop me a line,

Pedro Vasconcelos
Department of Computer Science
Faculty of Science, University of Porto, Portugal