I played the board game "Bunkers" at the end of the year and was interested in the fact that there was a house that was clearly easy to stop, so I decided to simulate it and calculate the ease of stopping. The environment was Pythonista on the iPhone.
For those who want to know only the result, the execution result is shown first. The horizontal axis is the number of times the simulation stopped.
Perform a simulation, count the number of times you have stopped at home, and repeat it a sufficiently large number to compare the converged values.
There are 40 squares on the board, and after the 40th, it returns to the 1st. Therefore, the total number of movements is counted, and the cell is determined by the remainder calculation.
For squares that do not affect the ease of stopping (how to move), do not implement any particular details and treat them as squares where nothing happens (actually, money is taken or received).
It is determined that the square has stopped at the end of one turn. Because every time I stay at home, the turn ends there. Also, the purpose of this simulation is to calculate and compare the ease of stopping a house.
Evaluate the mass by creating a function to move the cell and moving through it.
Evaluation function of mass
def stepEval(steps, count, card):
if (count + steps) % len(BOARD) == 18:
if steps == 7:
return steps
if steps == 0:
return 0
else:
count += steps
next_steps = BOARD[where_board(count)].getMove(card, where_board(count))
return steps + stepEval(next_steps, count, card)
GitHub: https://github.com/huwns/bankers/blob/main/analyze_bankers.py
Recommended Posts