Hex

Published on Aug 24 2026 by Stephen Donlin

Hex

Hex board game

Hex is a two-player game strategy game where players compete by placing stones on an 11x11 rhombus-shaped board of hexagonal tiles. The first player to connect two opposite edges of the board is the winner. No matter how the stones are placed on the board, a game of Hex will always have exactly one winner. Although the rules of the game are quite simple, it is rooted in mathematical concepts such as combinatorics, topology, and graph theory.

This project implements the Singleton pattern to manage gameplay and the observer pattern to signal user input that updates the graphics and interface. The disjoint-set (or union-find forest) data structure and union-by-rank + path compression algorithm is used to query for unbroken links in near O(1) (constant) time. 

The project is built in C++ and uses the Qt6 framework for the GUI.