Skip to content
All projects

2024

Scrabble in Java: MVC, an AI opponent, custom boards

A course project that became a complete game: MVC, a brute-force AI player, XML boards with premium squares, a timed mode, undo and redo, save and load.

Team project for SYSC 3110, Software Development Project, in fall 2024. Four of us built a playable Scrabble in Java Swing; I wrote 38 of the 57 commits.

How it works

Game.java creates a Model, a View, and a Controller. The model is a serialisable singleton that holds the board, the premium squares, the players, the tile bag, and the observers, and it owns the rules: tile placement, word validation against a dictionary, scoring, and turn order. Boards are described in XML, so new layouts and premium squares load without code changes. A timer mode, undo and redo, and saving a game in progress were the stretch goals.

The AI player is brute force on purpose: it generates permutations of up to seven rack tiles, filters them against the word set, sorts by score, and tries placements until the model accepts one. It works, and it was slow enough that view updates were silenced during AI turns. Known bug: the AI ignores premium squares when choosing a placement.

What I learned

We restructured the architecture partway through after conflicting changes landed on the main branch. That was the first time I saw why a team needs branch discipline before it needs features. JUnit tests cover the model and the controller.