The computer player was trained to use more

effective strategies.

What I changed
I replaced the random strategy class with the lookahead strategy class.

Why I changed it
By replacing the classes, the computer player stopped responding randomly and instead used data provided to integrate
effective strategies.

Estimate for remaining time to finish assignment: [1-2 hours depending on peer assistance]
This commit is contained in:
Justin Toombs
2024-02-12 22:54:26 -05:00
parent b84640e4b3
commit ab309c8be8
3 changed files with 8 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
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 +24,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."