-
Notifications
You must be signed in to change notification settings - Fork 1
/
my-zombie.py
28 lines (22 loc) · 887 Bytes
/
my-zombie.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import zombiedice
class MyZombie:
def __init__(self, name):
self.name = name
def turn(self, gameState):
diceRollResults = zombiedice.roll()
brains = 0
while diceRollResults is not None:
brains += diceRollResults['brains']
if brains < 2:
diceRollResults = zombiedice.roll()
else:
break
zombies = (
zombiedice.examples.RandomCoinFlipZombie(name="Random"),
zombiedice.examples.RollsUntilInTheLeadZombie(name="Until Leading"),
zombiedice.examples.MinNumShotgunsThenStopsZombie(name="Stop at 2 Shotguns", minShotguns=2),
zombiedice.examples.MinNumShotgunsThenStopsZombie(name="Stop at 1 Shotguns", minShotguns=1),
MyZombie(name="My Zombie Bot")
)
zombiedice.runTournament(zombies=zombies, numGames=100)
zombiedice.runWebGui(zombies=zombies, numGames=100)