Skip to content
Martin Poiroux
Language : Français
Projects · CodeCode · Games · 2026

Malefiz

The Malefiz board game written in C++ with SDL2: four players, dice, barricades to push around, and an AI that shows its reasoning next to the board.

Malefiz is a four-player race game on a pyramid-shaped board of seventeen columns by nineteen rows. Each side has five pawns, eleven barricades block the passages, and a die decides the length of each move. Placing a barricade in the right spot often counts more than advancing.

Animated diagram: on each roll, the AI scores the possible moves and plays the best one. A barricade cannot be passed; you take it by landing on it.

The program is written in C++17 with SDL2 for rendering. Rules, game state and rendering are separate, which allows games to run without an interface for measurement.

Four AIs playing each other, mid-game: each pawn moves by the die, and barricades are set back down on the others’ paths.

The interesting part is the artificial opponent, and the die changes everything there: unlike chess, there is no certain best move, only a best expectation. The program therefore offers three levels. A direct heuristic, which picks the best pawn-destination pair without exploring anything. A Monte Carlo search, which simulates games to the end and keeps what wins most often. And a version guided by a neural network, which supplies the search with move priorities and a position estimate instead of simulating to the end. The network reads the board as twelve planes: the pawns of each of the four players, the barricades, the finish squares, the bases, the player to move and the die value. It trains by playing against itself.

Later in the same game: most barricades have been pushed up the board, in front of the goal.

The interface shows what the search is doing: number of simulations, speed, average depth, win chance per colour, and the gap between the static estimate and the simulated one. It is useful for playing, but it was written mainly to see when the evaluation is wrong.

The second barricade game on this site is Barricade, played neither with dice nor by four: the two repositories are independent.

Private project, no public link