MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / Zombie

Class Zombie

src/gamesbyexample/zombiebitefight.py:45–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43# A list of chr() codes is at https://inventwithpython.com/chr
44
45class Zombie:
46 def __init__(self, color):
47 if color not in ('red', 'green', 'blue', 'yellow', 'cyan', 'purple', 'white', 'black'):
48 raise Exception('color arg must be one of: red green blue yellow cyan purple white black')
49 self.__class__.color = color
50 self.direction = random.choice([NORTH, SOUTH, EAST, WEST])
51 self._x = None
52 self._y = None
53
54 def getAction(self):
55 # Returns one of RIGHT, LEFT, FORWARD, STAY.
56 return STAY
57
58
59class WanderingZombie(Zombie):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected