@hackage babylon0.3
An implementation of a simple 2-player board game
Categories
License
LicenseRef-GPL
Maintainer
Pedro Vasconcelos <pbv@dcc.fc.up.pt>
Links
- Documentation
- No source repository
- Security
Versions
Installation
Dependencies (0)
Dependents (1)
@hackage/acme-everything
Babylon
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 pbv@dcc.fc.up.pt Department of Computer Science Faculty of Science, University of Porto, Portugal