Exemplo n.º 1
0
import TicTacToe
import Player

human1_test = Player.Human("x")  # Player -> File; Human -> Class
ais_test = Player.AI("o")
#human2_test = Player.Human("o")
object1 = TicTacToe.TicTacToe(
    human1_test, ais_test)  # 1st TTT -> FileName; 2nd TTT -> Class name

#object1.reset_game()
#object1.print_score()

object1.print_state()
object1.game_loop()
Exemplo n.º 2
0
            if i % 2 == 0:
                if self.p1.type == 'H':
                    print("\t\t[Player1's Move]")
                else:
                    print("\t\t[Player2's Move]")
                self.p1.move(self)
            else:
                if self.p2.type == 'H':
                    print("\t\t[Player2's Move]")
                else:
                    print("\t\t[Player1's Move]")

                self.p2.move(self)

            if self.is_gameover():
                self.print_board()
                if self.winner == ' ':
                    print("\nGame over with Draw")
                else:
                    print("\nWinner : %s" % self.winner)
                return


if __name__ == '__main__':
    game = GAME()
    player1 = Player.AI("X")
    player2 = Player.Human("O")
    '''player2 =Player.Dummy("O")'''
    game.play(player1, player2)