def end(self):
     if len(self.rounds) == 1:
         self.questions_asked.clear_all()
         self.connection.send(
             Chat.end_game(self.player_scores.game_winners()))
         self.player_scores.score_winners()
         self.player_scores.reset_scores_for_next_game()
 def test_chat_includes_an_end_of_round_signoff_for_end_rounds(self):
     players = [("GoldPlayer", 5), ("SilverPlayer", 4), ("BronzePlayer", 3)]
     actual = Subject.end_round(players)
     conclusion_included = False
     for option in Subject.end_round_conclusion:
         if option in actual:
             conclusion_included = True
     self.assertTrue(conclusion_included)
 def test_chat_includes_an_end_game_signoff_for_end_games(self):
     players = [("GoldPlayer", 5), ("SilverPlayer", 4), ("BronzePlayer", 3)]
     actual = Subject.end_game(players)
     signoff_included = False
     for option in Subject.end_game_signoff:
         if option in actual:
             signoff_included = True
     self.assertTrue(signoff_included)
 def test_chat_includes_a_new_game_catchprase_for_new_games(self):
     players = [("GoldPlayer", 5), ("SilverPlayer", 4), ("BronzePlayer", 3),
                ("CopperPlayer", 2), ("IronPlayer", 1)]
     actual = Subject.new_game(players)
     catchphrase_included = False
     for option in Subject.new_game_catchphrase:
         if option in actual:
             catchphrase_included = True
     self.assertTrue(catchphrase_included)
Пример #5
0
 def run(self):
     question_answered = False
     hint_1_given = False
     hint_2_given = False
     times_up = False
     while(not times_up and not question_answered):
         time.sleep(self.connection.seconds_per_message)
         response = self.connection.last_response
         if self.check_answer(response[1]):
             question_answered = True
             self.player_scores.score(response[0])
             self.connection.send(Chat.correct_answer(response[0]))
         if not question_answered and not hint_2_given and self.timer.question_hint_2_up():
             hint_2_given = True
             self.connection.send(self.second_hint())
         elif not question_answered and not hint_1_given and self.timer.question_hint_1_up():
             hint_1_given = True
             self.connection.send(self.first_hint())
         times_up = self.timer.question_time_up()
     if not question_answered:
         self.connection.send(random.choice(Chat.unanswered_questions))
 def end(self):
     self.connection.send(Chat.end_round(
         self.player_scores.round_winners()))
     self.player_scores.reset_scores_for_next_round()
 def start(self):
     self.connection.send(Chat.new_round(self.name))
 def start(self):
     self.rounds = self.init_rounds()
     self.connection.send(Chat.new_game(self.player_scores.top_players()))
 def test_chat_end_round_message_not_too_long(self):
     players = [("ABCDEFGHIJKLMNOPQRSTUVWXY", 5000),
                ("UserNameThats25characters", 4000),
                ("leutenant_junior_grade_bo", 3000)]
     actual = Subject.end_round(players)
     self.assertLessEqual(len(actual), 255)