About Monte Carlo Simulation
The goal of Monte Carlo simulation is to understand a phenomenon by repeating it a large number of times and
recording quantities of interest each time. For instance: suppose you are unsure how often a flipped coin will land heads.
One way to determine this is to flip the coin 100 times, and record how many of the results were heads. When we aggregate
these results and look at their frequencies, this is known as an
empirical distribution.
With something more complex, such as a game of Catan, it takes too much time to do this sort of repetition manually.
This is where code comes in. If we write logic to represent the
relevant (not necessarily
all) rules and structure of the game,
a computer can record, rinse, and repeat much faster than we could hope to as humans.
Simulation Setup
- Every time the table is updated, 1000 simulations occur in-browser (i.e. nothing is sent to a server)
- Each simulation describes the following scenario: I start from an empty hand. Two dice are rolled repeatedly to represent turns. With each roll, I collect
resources according to what is on the board. Allowing for trade with the bank, how many rolls does it take to get the resources to build a road?
A settlement? And so on.
- For the sake of runtime, each simulation stops after 120 rolls
- This setup does NOT account for the robber, use of development cards, or trade with other players
- The simulation results are aggregated into an empirical distribution of turn counts, and displayed as a histogram
- The histograms will appear slightly different in separate instances of simulations for the same board. To see this for yourself,
type in a number into the table below, and then press the space bar. This is due to the inherent randomness involved in the simulation process.
Interpretation
Finally, a word on how to interpret the Monte Carlo results in the histograms. Suppose I have a situation where I do not have settlements or cities around
any ore-producing hexes. Because upgrading a settlement to a city requires 3 ore,
I would need to trade my other resources with the bank (or other players, but the simulation does not account for this).
Suppose also that I receive a large amount of lumber on average. Then intuitively, having a settlement next to the 2:1 lumber port
would allow me to trade for ore faster. We can see this idea confirmed in the accompanying GIF - when I toggle
the 2:1 lumber checkbox on and off, the empirical distribution shifts backward and forward respectively. This shows that even with
the same resource set-up, building this port would allow us to build cities ~20 turns faster on average.
Now, this example is something that most players would understand quickly without simulation.
The magic of Monte Carlo is that we can ask more complex questions about the game, with the exact same setup.
From the very beginning of a game, we can gain an understanding of what players are
in a position to do well at the endgame, by looking at their ability to build cities and
buy development cards. We can ask which new settlement placement would yield the most benefits down the road.
While our simulation is not perfect, it can still help us make better-informed decisions.