Programming AI Bots for Zombie Dice

  • The ZombieBot_RandomCoinFlip bot simply has a 50/50 chance of continuing to call the roll() function or stopping. It'll most likely lose most games.
  • The ZombieBot_MinNumShotgunsThenStops bot will continue to call the roll() function until it has a minimum number of shotgun rolls. This minimum can be set by passing an integer for the minShotguns parameter.
  • The ZombieBot_HumanPlayer bot actually uses print() and input() calls so that a human player can play against the bots.
  • The ZombieBot_RollsUntilInTheLead bot will keep rolling until it gets into the lead compared to the other bots. This bot takes higher risks once it starts trailing.
  • The ZombieBot_MonteCarlo bot is the most sophisticated of all the bots. It basically runs several random experiments to see if the next roll would result in 3 or more shotguns. You can pass different values to the constructors to tell it how many experiments to run on each turn and what percentage of them must not result in death to roll again.

Write your own bots and then see how they do against these simple bots. You can post your code to https://gist.github.com and post a link to it in the comments section below.

Page 3 of 3 | Previous page

5 comments on this post.
  1. Shane:

    I made a really simple bot that seems to beat the built-in bots. Can anybody compete? Like I said, really, really simple.

    https://gist.github.com/4133663

  2. Nick:

    I made one based on calculated risk vs reward depending on the footprints dice in hand and the amount of each dice colour left in the pile. Also made it so that the bots makes more risky plays when behind and safer plays when ahead. It’s not the best bot but it tries its hardest, the little trooper.

    Code: https://gist.github.com/4186279
    Blog post: http://holtcode.blogspot.com/2012/12/zombie-ai.html

  3. Python Programmer:

    Cool idea, and I like the zombie theme. Excellent explanation of using classes in Python. This should serve as a reference for anyone learning Python.

  4. Meryl van der Merwe:

    I had no idea your books were free to download – that is awesome. I will use them to teach my 13 year old Python and will link to your website from my page on how to teach Programming to children.

  5. Spencer Herzberg:

    It would be really neat to build a scalatron (https://github.com/scalatron/scalatron) like web interface for a nice way to setup and manage tournaments.

    Good work so far!

Leave a comment