Esempio n. 1
0
 def test_game_util_is_winner(self):
     """GameUtil.is_winner() should give expected results for mentioned cases"""
     for given_playground, expected_result in self.expected_values_is_winner:
         test_game = GameUtil.GameUtil()
         test_game.get_playground().fields = given_playground
         result = test_game.is_winner()
         self.assertEqual(expected_result, result)
Esempio n. 2
0
__author__ = 'michal'

import GameUtil

# 'main' executable file

game = GameUtil.GameUtil()
game.print_on_start()
player1 = game.create_player('O')
player2 = game.create_player('X')

game.set_turn(player1)

first_turn = True
one_won = False
game_result = False, ''

while not one_won and game.get_playground().is_any_field_empty():
    if first_turn:
        pass
    else:
        if game.get_turn() == player1:
            game.set_turn(player2)
        else:
            game.set_turn(player1)

    first_turn = False

    game.get_playground().show_playground()
    inp = game.get_player_turn()
    while not game.parse_input(inp):