Skip to content

Lol

Lol, bring the runestone to the Jarl, is a Viking card game of deduction for two to four players. Its rules are short, but its cards interact: one card forces another to be played, one card can only be aimed at certain players, one card shows you something nobody else sees. That makes it the place where rules stop being only code and become statements: claims about every game, which you can state on their own and prove.

The rules

This is how the rules file, Games/LoL/Rules.lean, sums them up at the top:

Each player holds one card. On your turn you draw a second, then play one of the two face up and resolve its effect:

value card count effect
1 Raider 5 Name a non-Raider card. If the target holds it, they are out.
2 Seer 2 Look at the target's hand (only you see it).
3 Holmgang 2 Duel: you and the target compare hands privately; the lower value is out.
4 Shieldmaiden 2 You cannot be targeted until your next turn.
5 Loki 2 The target (possibly you) discards their hand and draws a new card.
6 Trader 1 Swap hands with the target.
7 Valkyrie 1 No effect, but must be played if held with Loki or the Trader.
8 Runestone 1 If you ever discard it, you are out.

Targets are other players who are still in and not protected; Loki may also target yourself. If no one else can be targeted, a targeting card is played with no effect (Loki then targets you).

One card is set aside face down at the start of each round; with two players, three more are set aside face up. A Loki target who must draw from an empty deck takes the face-down card. A round ends when only one player is left, or when the deck is empty after a turn: the highest card wins, ties broken by the higher total of discards, and every player still tied wins. Each round winner gains an arm ring; the first player to the ring target (7, 5 or 4 for 2, 3 or 4 players) wins the game. Otherwise the first round winner starts the next.

There is one more rule the summary leaves out, because it is about the table rather than the cards. When a play shows someone a card (the Seer, a tied Holmgang, a trade), the game waits until each of them nods to say they have seen it. Only then does the turn end.

The files

File What it holds
Games/LoL/Rules.lean The rules: the cards, the state, what a legal play is, each card's effect, and step
Games/LoL/Game.lean How the engine shows Lol to players: what each one sees, the plays offered, the words on screen
Games/LoL/NAMES.md Every name a player sees, and what it stands for in the original game
Proofs/LoL/Guarantees.lean What the rules are proven to ensure, in plain words
Proofs/LoL/Bookkeeping.lean The smaller facts those proofs are built from
Tests/LoL.lean A scenario for every card and rule, and whole games of random play

The code uses plain names that describe what a card does (raider, holmgang), and the words players see live only in Game.lean. Renaming a card is a one-line change there.

In this section

This section assumes you have worked through Snap: it uses structures, lists, match, #guard, and the tactics from there without explaining them again.

  1. The cards and the table: a type with many alternatives, functions defined case by case, and building the deck.
  2. What a legal play is: rules written as statements, the code that checks them, and a proof that the two agree.
  3. What players know: hidden information as part of the state, events with audiences, nods, and proving that what players know is true.
  4. Changing the rules: change Lol's rules and see what the tests and proofs say.