generated from mwc/lab_tic_tac_toe
(Commit summary. Replace this with a one-line description of this commit.)
initial commit What I changed (Replace this with a description of what you changed in this commit. This should be 1-2 sentences.) added notes.md Why I changed it (Describe why you made these changes. Were you working toward a goal? Did you reorganize your code? This should be 1-2 sentences.) explained states Estimate for remaining time to finish assignment: [1 day]
This commit is contained in:
@@ -67,9 +67,9 @@ class TTTGame:
|
||||
for i in range(3):
|
||||
if currentState[i] == symbol and currentState[i+3] == symbol and currentState[i+6] == symbol:
|
||||
return True
|
||||
if currentState[0] == symbol and currentState[4] == symbol and currentState[8] == symbol:
|
||||
if currentState[4] == symbol and currentState[0] == symbol and currentState[8] == symbol:
|
||||
return True
|
||||
if currentState[2] == symbol and currentState[4] == symbol and currentState[6] ==symbol:
|
||||
if currentState[4] == symbol and currentState[2] == symbol and currentState[6] ==symbol:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@@ -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 #may need to delete ttt for this to work
|
||||
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(), deterministic=False)
|
||||
|
||||
def choose_action(self, state):
|
||||
"Chooses a random move from the moves available."
|
||||
|
||||
Reference in New Issue
Block a user