A Strategy for “Mensch Ärgere Dich Nicht”
Last year I visited family in Vienna. One rainy afternoon we decided to play a very German dice-game called mensch ärgere dich nicht, which means something like: don’t work yourself up, man. Despite her wheelchair my grandmother beat us three times in a row and I was annoyed.
I decided I should figure out this game and find out if there is a simple strategy that works. Understand that this is an exceedingly simple game. And, as you will see, it is not even clear if there is much of a strategy; the outcome may be determined solely by the dice. My idea is as follows: to devise a number of simple strategies and let the computer play them to figure out the best ones. It also provided me with an excuse to try the new programming language Elm.
The rules of the game
The game is played by four players (red, blue, green and yellow) each with four pieces. A player wins if she manages to move all her tokens to the home row from the starting position, traversing the full board in a clockwise direction. Without further ado, play a game.
You are the red player and are lucky to start with a six. You have to click on the board to let the AI move.
The rules are as follows:
- Players play in turns in clockwise order starting with the person that wins a first roll.
- A turn starts with a die roll.
- If the player rolls six she can move a piece onto the game. Otherwise she may move one token the exact number of steps in clockwise direction. If a token is moved on top of token, the other token is returned to the starting position and has to start over.
- In the home row, tokens ‘bounce’ off the end, reversing direction for the remaining steps in a throw
- If possible, one should always move.
- Whenever the player rolls a six, she may do another turn.
- If no token can be moved, the turn ends without moving.
Looking for safe havens
My first thought was to see if there are places which are safer than others. To this end we simulate a game with AI players and count the number of times each a place is occupied by a token.
This leads to the following heat-map (redder if there are more combinations). Click to start the simulation.
The colors have been normalized such that red has the highest count and green the lowest. The simulation is executed with a different random seed every time this page is loaded and I cannot point to specific results.The heatmap is, however, likely so show that most places are equally likely to be occupied and in many cases that the last place before each player’s home row is very much occupied. The latter is to be expected because of tokens being blocked by others in the homerow or bounced back.
Many more simulations could be done to acquire more information, e.g., where are tokens more likely to be hit, but I’d rather just go on to devise strategies first.
Towards a human playable strategy
As there is so little choice in the game, especially since there usually are no more than two tokens on the board, it is hard to devise any strategy. Moreso to devise one simple enough for a casual player. Computers can even have (meaningful) strategies for rock-paper-scissors but humans are awfully limited. What I am looking for is a simple strategy that is easy to remember and execute. I especially do not want to count the odds of every move while playing.
To compose a strategy, I propose to combine a tactic and a style. The tactic determines the position on the board by choosing the token to move. The playing style determines if I play aggressively or defensively. For the fist, I propose the following simple tactics:
- The eager tactic where, if possible, we always advance the foremost token and otherwise the second token, etc.
- The hedge tactic where we always advance the hindmost token if possible, and otherwise the before-hindmost token, etc.
These three tactics aim for different positions on the board: the eager tactic tries to reach home as fast as possible by investing in only one token, and the hedge tactic is to spread investment over all your tokens so that one token being hit costs less.
The tactics completely disregard the opponent’s tokens: it only proposes an order by which to consider moving your own token. Therefore, I propose to combine these with the two natural playing styles:
- The aggressive style where we choose to hit an opponent whenever we can.
- The defensive style where we first consider the tokens that are in immediate danger of being hit but would be safe if moved and then the tokens that will be safe after moving.
We can now compose a strategy by choosing a tactic and style: The style determines what tokens are under first consideration for a move and the tactic is used to choose one of the moves. If the style has no good candidates, we consider all tokens.
For example, with a defensive style and eager tactic, we first consider all tokens that are in danger and would become safe after moving them. Of those tokens, we move the foremost (as dictated by the runner tactic). If, however, there are no tokens in danger, we move the foremost of all tokens that will be safe after moving. If there are no tokens whatsoever, we move the foremost of all tokens.
We can combine two styles with a priority. With a aggressive-defensive style, we first consider the tokens that can hit an opponent and be safe, if there are no such tokens we choose among the tokens that hit an opponent, if there are no such moves either, we choose according to the defensive style. With a defensive-aggressive style, we first consider the safe and aggressive moves, but then the safe ones first and only then the aggressive moves.
Thus we have defined four strategies, but who will rule them all? Only one way to find out…
Battle-testing the strategies
It is no coincidence we have four AIs: this way we can conveniently let them play against each other and tally their respective wins.The following chart shows the result of running a hundred games with random starting locations with
- the aggressive-defensive eager strategy in blue;
- the defensive-aggressive eager strategy in yellow;
- the aggressive-defensive hedge strategy in red; and
- the defensive-aggressive hedge strategy in green.
Click to start the simulations. They make take a while!
Again, this test is executed with a different random seed on every page-load and you can refresh until you obtain a result that fits your beliefs. In most simulations the blue and yellow eager strategy with either playing style wins more often than the hedging strategy and the defensive-aggressive style usually trumps the aggressive-defensive style.
Overall the yellow defensive-aggressive eager player wins the most games and seems to be the most advisable strategy. It also suggests that playing defensively rather than aggressively is better for both the eager and hedge strategies. That said, you’re not really likely to notice the difference when playing one or two games.
Of course this test is rather unsophisticated and statistically unsound. Not to mention the fact that there are many more possible strategies that could be tested. Much future work ™ is required to get any definitive answer. First and foremost, one should test the strategies against an AI that plays random moves and see if they are significantly better.
Despite the utter pointlessness of this game, I had fun writing the game and the experiments.
Along the way I learned much about
- the programming language Elm, its libraries and lovely community;
- pseudo random generation with multiply-by-carry;
- unbiased shuffling with Fisher-Yates-Knuth;
- drawing pictures using turtle graphics.
The code is available on github, but beware it was written with the diligence of your average research project.
Now, if you would excuse me, I’ve got to play some games.