Pentacle

The AI

A Splendor-style board game AI that taught itself

Pentacle's opponent was not given a strategy. It is a neural network that learned how to win by playing the game, over and over.

How it was trained

The AI was trained with reinforcement learning. At the start it knows the rules and nothing else. It then plays game after game against itself and its own earlier versions. Choices that came before a win are made a little more likely, choices that came before a loss a little less. Repeat that enough times and a real strategy appears without anyone writing it down.

The algorithm is PPO (Proximal Policy Optimization), which improves the policy in small, careful steps so training stays stable. Learning by self-play like this has been the standard route for game AI since AlphaGo.

The AI sees what you see on screen: the face-up cards, the tokens in the bank, the sages, and both players' tokens, cards and reserved cards. The order of the face-down decks is not part of its input.

The levels and their Elo

Each level is the network taken from a different point in training: the same AI with less or more experience. Level 3, Adept, is the exception: a simple rule-based bot that buys scoring cards first.

LevelNameEloRelative strength
1Beginner791
2Apprentice928
3Adept1113
4Expert1185
5Veteran1370
6Master1529
7Grandmaster1702
8Legend1893

The ratings come from games played with the same deterministic choices as the server, anchored at Greedy (level 3) = 1113. A 200-point gap means the stronger side wins about three games in four. The ratings are estimates, not exact measures.

Level 8 adds a light look-ahead search on top of its network: before each move it tries out a handful of ways the game could go. There is also a level 9 (Elo about 2040) that searches deeper with the same network. It is switched off for now because each of its moves costs a lot of server time. The ratings for levels 8 and 9 come from fewer games than the others, so they are rougher.

What the AI win chance means

The AI panel, with the AI win chance next to the AI name
The AI win chance next to the AI's name.

Every time the AI moves, the game shows the AI win chance next to its name: the chance the AI wins from here if both sides played like the strongest AI. The number does not come from the AI you are playing but from a separate evaluation model, trained on 100,000 self-play games of the strongest AI. The same model is used at every level, so level 3 shows it too. Play well and it drops; slip up and it climbs. It turns green when you are ahead and red when the AI is.

It starts near 50% on the first move. Checked against real self-play games, its numbers held up: positions it called 70% were won about seven times in ten, and its figures matched the actual results within about one percentage point. It says who is better placed, not how likely this particular AI is to beat you. Against a lower level, a position leaning the AI's way can still be turned around.

The AI runs on a server

The game itself runs in your browser, but the AI thinks on a server. On its turn the current position is sent to the server, which replies with the AI's move. That way you get the same AI on any phone or computer, with nothing to download. The server also checks every move against the rules, so the AI plays by exactly the same rules you do.

If your connection drops, the AI can't move and the game shows a retry button.

New to the rules? Start with how to play. Anything else is probably in the FAQ.

How far up the ladder can you get?

Play now