Create a new duckling with random body features.
(self)
| 71 | |
| 72 | class Duckling: |
| 73 | def __init__(self): |
| 74 | """Create a new duckling with random body features.""" |
| 75 | self.direction = random.choice([LEFT, RIGHT]) |
| 76 | self.body = random.choice([CHUBBY, VERY_CHUBBY]) |
| 77 | self.mouth = random.choice([OPEN, CLOSED]) |
| 78 | self.wing = random.choice([OUT, UP, DOWN]) |
| 79 | |
| 80 | if self.body == CHUBBY: |
| 81 | # Chubby ducklings can only have beady eyes. |
| 82 | self.eyes = BEADY |
| 83 | else: |
| 84 | self.eyes = random.choice([BEADY, WIDE, HAPPY, ALOOF]) |
| 85 | |
| 86 | self.partToDisplayNext = HEAD |
| 87 | |
| 88 | def getHeadStr(self): |
| 89 | """Returns the string of the duckling's head.""" |
nothing calls this directly
no outgoing calls
no test coverage detected