Silly Games
A few times I've gotten a notion to do simulations of simple board games. I was inspired by playing Chutes and Ladders with my son. I realized that I would much rather write a computer program to play this game for me, so I did. It could play 2.8 million games per second, and I collected some data:
I did similar projects for Bingo and Tic Tac Toe, and I dunno probably others that I don't remember.
- Average game is 18.7 rounds, with 73.4 spins.
- Shortest observed game was 7 rounds, longest 145.
- The ladders help more than the chutes hurt.
- Players going first have an advantage.
- Most of the game is spent on the bottom half of the board.
![]() |
Heat map of most common player positions |
// 100 entries, containing the space number you should move to.
// If a ladder, contains a number higher than the index it's at
// If a slide, contains a smaller number than the index it's at
// If neither, contains its own index.
int[] spaces;
// current space each player is on, size == 4
int[] players;
while (true) // keep playing 'til someone wins
{
for (int i = 0; i < playerCount; i++)
{
int p = players[i] + Spin(); // add between 1 and 6
if ((players[i] = spaces[p]) == lastSpace)
return i; // return the player number of the victor
}
}
I did similar projects for Bingo and Tic Tac Toe, and I dunno probably others that I don't remember.
Relatedly, check out http://xkcd.com/903/. On the mouseover text, it reads:
"Wikipedia trivia: if you take any article, click on the first link in the article text not in parentheses or italics, and then repeat, you will eventually end up at 'Philosophy'"
So I wrote a bot to check. As of June 2, 2015, out of 259,184 articles found and "resolved", which means to trace back until I find where they lead, 93% lead to Philosophy, 6% to other loops, and 1% to dead ends. Average distance from an article to Philosophy was 19.95 links. The longest chain found was 313. An interesting challenge was that as I was trying to collect statistics, there were active edit wars on key articles intended specifically to either break or fix this game!
Comments
Post a Comment