Completed checkpoint 3

What I changed
(I gave the computer player the look ahead strategy. This also required importing LookaheadStrategy in player.py.
I also answered the questions in notes.md.)

Why I changed it
(I was working on completing checkpoint 3. I realized I had to do the importing since otherwise it wouldn't let me play.)

Estimate for remaining time to finish assignment: [I am REALLY bad at these estimates. I mean in terms of actual work time, I'm probably not too far off. Fingers crossed, maybe another hour of actual work time?]
This commit is contained in:
Cory 2024-03-20 20:13:39 -04:00
parent 9500a68ae7
commit 0a3d7e31f5
3 changed files with 5 additions and 3 deletions

View File

@ -37,4 +37,5 @@ For the first one, I would put an X on the rightmost cell in the middle row. Thi
You can get the inital game state using game.get_initial_state().
What is the current and future reward for this state? What does this mean?
The current and future reward for this state is 1. This means the state favors player X assuming both players continue using the same look ahead strategy.

View File

@ -2,8 +2,8 @@ from ttt.game import TTTGame
from ttt.view import TTTView
from ttt.player import TTTHumanPlayer, TTTComputerPlayer
player0 = TTTHumanPlayer("Player 1")
player1 = TTTHumanPlayer("Player 2")
player0 = TTTHumanPlayer("Pleayer 1")
player1 = TTTComputerPlayer("Robot 1")
game = TTTGame()
view = TTTView(player0, player1)

View File

@ -1,4 +1,5 @@
from click import Choice, prompt
from strategy.lookahead_strategy import LookaheadStrategy
from strategy.random_strategy import RandomStrategy
from ttt.game import TTTGame
import random
@ -24,7 +25,7 @@ class TTTComputerPlayer:
def __init__(self, name):
"Sets up the player."
self.name = name
self.strategy = RandomStrategy(TTTGame())
self.strategy = LookaheadStrategy(TTTGame(),deterministic=False)
def choose_action(self, state):
"Chooses a random move from the moves available."