Cards (Ada types, contracts) → Game (shuffle, tricks, wars): played
Game (shuffle, tricks, wars) → Terminal (trick by trick): tells
Game (shuffle, tricks, wars) → Statistics (100,000 games)
Statistics (100,000 games) → stats.json (read at site build): written as JSON
stats.json (read at site build) → Project page (charts)
Tests (AUnit) → Game (shuffle, tricks, wars): check
What 100,000 games say
The Ada program played the 100,000 games of seeds 1 to 100,000, up to 10,000 plies each; the figures come from its output file, recomputed by CI.
of the games never end (42,346 games)
42.4 %
plies on average when the game ends
1,689
wars per game, on average
39.2
of the finished games won by the first player
52.9 %
plies from the shortest to the longest
20 – 9,994
Why so many endless games? Here the winner of a trick always picks the cards up in the same order: the game becomes deterministic and can cycle. Between real players the order changes from trick to trick and the game nearly always ends.
bataille --seed 44276 # the longest game that ends, in 9,994 plies
bataille --stats 100000
Tech stack
Ada
Alire
AUnit
Who does what
Ada
The game: types that rule out impossible cards, packs with contracts, an xorshift64 shuffle; 100,000 simulated games for the project page's statistics.
Alire
The same GNAT toolchain and AUnit locally and in CI, on the three systems.
AUnit
Tests of the rules, the contracts and the shuffle.
Definition of Done
Code reviewed, diff by diff
Unit and integration tests green
Green CI on Linux, Windows and macOS when compiled