()
| 85 | |
| 86 | class Duckling { |
| 87 | constructor() { |
| 88 | // Create a new duckling with random body features. |
| 89 | this.direction = [LEFT, RIGHT][Math.floor(Math.random() * 2)]; |
| 90 | this.body = [CHUBBY, VERY_CHUBBY][Math.floor(Math.random() * 2)]; |
| 91 | this.mouth = [OPEN, CLOSED][Math.floor(Math.random() * 2)]; |
| 92 | this.wing = [OUT, UP, DOWN][Math.floor(Math.random() * 3)]; |
| 93 | |
| 94 | if (this.body === CHUBBY) { |
| 95 | // Chubby ducklings can only have beady eyes. |
| 96 | this.eyes = BEADY; |
| 97 | } else { |
| 98 | this.eyes = [BEADY, WIDE, HAPPY, ALOOF][Math.floor(Math.random() * 4)]; |
| 99 | } |
| 100 | |
| 101 | this.partToDisplayNext = HEAD; |
| 102 | } |
| 103 | |
| 104 | getHeadStr() { |
| 105 | // Returns the string of the duckling's head. |
nothing calls this directly
no outgoing calls
no test coverage detected