Skip to main content

A simulator for the dice game Zombie Dice that can run bot AI players.

Project description

A simulator for the dice game Zombie Dice that can run bot AI players.

A full (but outdated) blog article explaining how these programs work (and the rules of Zombie Dice) can be found here: http://inventwithpython.com/blog/2012/11/21/how-to-make-ai-bots-for-zombie-dice/

This is useful for beginner/intermediate programming lessons or contests. The API for making bots is simple, and it features a web UI for projecting a nifty display of the tournament as it runs.

screenshot.jpg

Quickstart

First, you need to learn how to play Zombie Dice (this takes just a few minutes):

Next, you need to create your own zombie. This is done by creating a class that implements a turn() method (called when it is your zombie’s turn). The turn() method either calls the zombiedice.roll() function if you want to roll again, or returns to signal the end of their turn. The turn() method accepts one argument of the game state (documented later on this page). This class should also have a 'name' attribute that contains a string of the player name. (This is so that the same class can be used for multiple players in a game.)

The zombiedice.roll() function returns a list of dictionaries. The dictionaries represent the dice roll results; it has a 'color' and 'icon' keys, which have possible values of 'green', 'yellow', 'red' and 'shotgun', 'brains', and 'footsteps' respectively. The list will contain three of these dictionaries for the three dice roll results. If the player has reached three shotguns or more, this list will be empty.

Here’s an example of a zombie that keeps rolling until they’ve reached two shotguns, then stops. More example zombies can be found in examples.py in the zombiedice package.

To run a tournament, create a file that calls either zombiedice.runWebGui() (for the nice web GUI) or zombiedice.runTournament() (for the plain command line interface). A typical file will look like demo.py in the repo:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zombiedice-0.1.0.tar.gz (191.5 kB view details)

Uploaded Source

File details

Details for the file zombiedice-0.1.0.tar.gz.

File metadata

  • Download URL: zombiedice-0.1.0.tar.gz
  • Upload date:
  • Size: 191.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.1rc1

File hashes

Hashes for zombiedice-0.1.0.tar.gz
Algorithm Hash digest
SHA256 777c4b76cef4e56b02295bbd64e267983eae5e0c44bdea9221bd9866bca7adff
MD5 f2d365789eaf999dfc588ec984ce7b03
BLAKE2b-256 1d9a53fe329bc294c37c85d80f4d90ba1d9de725164d2734db44eaf91b77ab0b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page