# Using AI to Determine Strategy in Machi Koro

|

July 30, 2017

Last week I wrote an article on teaching an AI to play Machi Koro using neural networks. A few major findings from that article were

1. The best first move is to buy a ranch
2. Turn order has a huge affect on chances of winning a game (earlier is better)

Afterwards, I looked at some more in-depth statistics by simulating 10,000 games and processing the data. The main questions I wanted to answer with visualizations are

1. What build orders of the victory buildings (the four buildings one needs to build to win the game) are most common?
2. Of these build orders, what turns are they usually built at?
3. At each stage of building these victory buildings, what other properties does the winning player usually have?

## Victory Building Build Order

The most common build orders all start with the shopping mall, which increases the amount of coins certain properties generate, and is the second-cheapest. The most popular victory path involves building the radio tower, which lets you reroll your dice once per turn, second. This is also the most expensive building, but it is notable that the computer found it worthwile to pursue immediately after building a shopping mall.

Going forward, I will be only looking at the top 10 most frequent build orders, which also have more than 100 examples out of the 10,000 simulations.

## Victory Building Build Order Turn Frequency

In general, the first victory building is often built around a player's seventh through tenth turn (25-40 turns overall). The fastest victories involve building the radio tower as one of the first two buildings, but 60% of the builds focus on shopping malls first. It is likely that players with major windfalls earlier on wait a couple more turns to buy a radio tower, which would likely ensure their victory if no one else has.

## Overall Properties Built with Different Victory Paths

Below is a GIF of the frequencies of what properties a player had at various stages of the game with different build orders. While the builds in general are useful for applying them to strategy, seeing the differences between different build paths can also be useful in a game where all of a certain property has been taken, and an alternate needs to be chosen.

Major takeaways from the image(s):

1. Get a ranch first. This is partially fromt he previous analysis, but the fact that the average hardly changes across the turns indicates that it's a top priority
2. It is a good idea to get an additional wheat field before you build your first property. 2 extra seems to be average if you are going for a radio tower (not recommended).
3. Getting one cafe early on is recommended, and possibly a second later in the game
4. Getting a bakery early is important, and ideally you should try to get a second one after your first victory building.
5. One convenience store is a good investment early on, and a second after your first victory building is recommended.
6. Stadiums are the only worthwhile purple card to purchase.
7. apple orchards, cheese factories, fruit & veg. marts, furniture factories, and mines are not worthwile to purchase in most cases.

## Code References

In case you want to see the code used:

Tags: