Programming AI Bots for Zombie Dice
- The
ZombieBot_RandomCoinFlipbot simply has a 50/50 chance of continuing to call theroll()function or stopping. It'll most likely lose most games. - The
ZombieBot_MinNumShotgunsThenStopsbot will continue to call theroll()function until it has a minimum number of shotgun rolls. This minimum can be set by passing an integer for theminShotgunsparameter. - The
ZombieBot_HumanPlayerbot actually usesprint()andinput()calls so that a human player can play against the bots. - The
ZombieBot_RollsUntilInTheLeadbot 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_MonteCarlobot 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.
Shane:
November 22nd, 2012 at 6:46 pm
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
Nick:
December 1st, 2012 at 6:18 pm
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
Python Programmer:
December 29th, 2012 at 10:37 pm
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.
Meryl van der Merwe:
March 16th, 2013 at 5:40 pm
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.