Implementation of the classic Worms game written entirely in Haskell, using the Gloss graphics library. Turn-based artillery gameplay with destructible terrain, projectile physics and collision handling, built on an immutable game state. Developed for the Laboratórios de Informática / Programação I course at the University of Minho.
Group project developed by:
- Gonçalo Pereira (@pereiravp)
- David Mimoso (@davidmimoso)
The project reimplements the core mechanics of Worms under a strictly functional paradigm. The game state is modelled immutably and advanced through pure transformations driven by player input and the passage of time. The main development effort went into:
- Representation and manipulation of the game state.
- Terrain modelling, movement, and collision resolution.
- Projectile physics and terrain destruction.
- A turn system managing multiple worms and weapons (bazooka, dynamite, mine, jetpack, among others).
- A graphical front end with a main menu, map selection, and win screen.
Main menu:
Gameplay:
The menu exposes a Bots option with scaffolding for one-human-versus-three-bots (config, naming, per-turn detection), but the bot decision logic itself was never implemented: on a bot's turn the state just passes through unchanged, so the mode is effectively non-functional. Human-versus-human play works as intended.
- GHC (GHC2021)
- Cabal
- Gloss / gloss-juicy (resolved automatically by Cabal)
# via SSH
git clone git@github.com:pereiravp/LP.git
# via HTTPS
git clone https://github.com/pereiravp/LP.git
cd LPcd 2025l1g019
cabal build
cabal run worms-gameImage assets (.bmp) are loaded relative to the assets/ directory, so the game must be run from 2025l1g019/.
| Key | Action |
|---|---|
| Left / Right | Move the worm |
| Space | Fire weapon / use jetpack |
| P | Pass the turn |
| Menu arrows | Navigate menu options |
The project ships feedback executables for each task (t1-feedback through t4-feedback).
cd 2025l1g019
# Run the tests for a task (Task 1 shown as an example)
cabal run t1-feedback
# Measure test coverage (Task 1 shown as an example)
./runcoverage.sh t1
# Generate documentation with Haddock
cabal haddock-projectLP/
├── 2025l1g019/
│ ├── app/ Graphical game (Main, Worms, Desenhar, Eventos, Tempo)
│ ├── lib/ Task logic (Tarefa1..4 and supporting modules)
│ ├── test/ Tests and oracles for each task
│ ├── assets/ Game images (.bmp)
│ ├── worms.cabal Cabal project configuration
│ └── README.md Interpreter, testing and documentation notes
├── docs/
│ └── screenshots/ Menu and gameplay screenshots
└── README.md This file
Developed for the Laboratórios de Informática / Programação I course, BSc in Computer Science (LCC), University of Minho (2024/2025).