Checkpoint 3

What I changed
I changed the computer to use the lookahead strategy rather than the random picker strategy.

Why I changed it
It's boring to play agains the computer when all it does is pick a random available spot. When the computer
plays intelligently it's more interesting and difficult.

Estimate for remaining time to finish assignment: [30 minutes to an hour]
This commit is contained in:
Thomas Naber
2024-02-25 21:52:47 -05:00
parent 0dbc59d637
commit c2ae97588a
4 changed files with 14 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
from click import Choice, prompt
from strategy.random_strategy import RandomStrategy
from strategy.lookahead_strategy import LookaheadStrategy
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())
def choose_action(self, state):
"Chooses a random move from the moves available."