Coursidor
A Quoridor variant on hexagonal boards: a C server loads two AI players as plug-ins and referees every move.
- 3
- board shapes
- 2
- strategies, A* and BFS
- 4
- people

The game
A variant of Quoridor on hexagonal boards. Two pawns must reach objectives placed symmetrically, then come back home. At each turn a player either moves, with jumps and longer steps, or places a wall to slow the other down, without ever blocking them completely. The project: a generic server in C that loads two players compiled as shared libraries, referees every move, and two players with their own strategy.
Try it: place walls
The three boards of the project, built like the code does. Each pawn shows its shortest path (breadth-first search) to its nearest objective. Click a link between two cells to wall it off: the server refuses any wall that would leave a player with no path.
Three boards, one coordinate system
Every cell is a pair of hexagonal coordinates (q, r), with a third one s = −q − r for checks. The condition max(|q|, |r|, |s|) < m draws a centred hexagon of size m: the triangular board. Keeping only the outer ring gives the cyclic board; cutting seven hexagonal holes gives the holed one. Cells are then numbered from 0 to n − 1, and the links between them live in a sparse adjacency matrix (GSL).

A server that trusts no one
The server loads the two players at run time with dlopen, then calls them in turn: initialize, play with the opponent's last move, and finalize. Each player gets its own copy of the board to simulate freely. Every move is checked: a pawn must land on a free neighbouring cell; a wall is first tried on a copy of the board, and kept only if both players still have a path to all their objectives. Any illegal move loses the game at once.
Two players, two strategies
- A* (player 1)Each possible move is scored f = g + h, with the hexagonal distance max(|Δq|, |Δr|, |Δs|) as the heuristic. When it keeps the same direction, it can move up to three cells at once.
- Breadth-first search (player 2)It finds the nearest objective by BFS and steps to the neighbour that brings it closest, jumping over the opponent when it stands in the way.
- Walls, for bothWhen the opponent is less than three moves from its next objective, the player tries pairs of links around it on a copy of the board, and keeps a wall only if it adds at least two steps to the opponent's path without blocking anyone.
Three real games
Run on 27 November 2026 from the code in the repository, the A* player against the BFS player on the three boards: 83 turns on the holed board, with walls validated by the server; 21 on the triangular board; 52 on the cyclic one. The three games are sped up so that they end together.
Tests
Five unit test files run together: adding and removing links, neighbours with walls, the existence of a path, and the generation of valid moves with jumps and multiple steps. Coverage is measured with gcov. Run again on 27 November 2026: all tests pass.
What we would have added
Our report ends with two ideas left for lack of time: games with more than two players, where every wall can help one opponent while slowing another; and a human player, who chooses each move in the terminal against one of the strategies. The figure at the top of this page is a small step in that direction.
The team
A first-year project in imperative programming at ENSEIRB-MATMECA (semester 6, 2024–2025), in a team of four. The code and the report are on GitHub.



