generated from mwc/lab_tic_tac_toe
What I changed Answered the questions and gave the computer a better strategy. Why I changed it I answered the questions to the best of my abilitiy. I gave the computer a better strategy as instructed. Estimate for remaining time to finish assignment: 30 minutes
16 lines
422 B
Python
16 lines
422 B
Python
from ttt.game import TTTGame
|
|
from ttt.view import TTTView
|
|
from ttt.player import TTTHumanPlayer, TTTComputerPlayer
|
|
|
|
player0 = TTTHumanPlayer("Player 1")
|
|
player1 = TTTComputerPlayer("Robot")
|
|
game = TTTGame()
|
|
view = TTTView(player0, player1)
|
|
|
|
state = game.get_initial_state()
|
|
view.greet()
|
|
while not game.is_over(state):
|
|
action = view.get_action(state)
|
|
state = game.get_next_state(state, action)
|
|
view.conclude(state)
|