class GuardedSuspensionPattern(object): """Demonstrates the guarded suspension pattern.""" def __init__(self): self.player1 = Player("Player1") self.player2 = Player("Player2") self.player3 = Player("Player3") self.coach = Coach() def demonstrate(self): self.player1.participate() self.player2.participate() self.player3.participate() self.coach.coach_the_game() time.sleep(5) self.coach.coach_the_game() time.sleep(5) self.coach.coach_the_game() time.sleep(5) self.coach.coach_the_game()
def throw_balls(self): while Coach.game_is_on(): print(self.name + " throws a ball!\n") sys.stdout.flush()
def __init__(self): self.player1 = Player("Player1") self.player2 = Player("Player2") self.player3 = Player("Player3") self.coach = Coach()