Files
lab_tic_tac_toe/play_ttt.py
root f5b1b03b9a Completed the tasks for checkpoint 3
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
2024-02-14 23:44:21 -05:00

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)