feat: time
This commit is contained in:
parent
f3afe492cf
commit
0e7e1c922d
@ -15,6 +15,7 @@
|
|||||||
from util import manhattanDistance
|
from util import manhattanDistance
|
||||||
from game import Directions
|
from game import Directions
|
||||||
import random, util
|
import random, util
|
||||||
|
import time
|
||||||
|
|
||||||
from game import Agent
|
from game import Agent
|
||||||
from pacman import GameState
|
from pacman import GameState
|
||||||
@ -162,7 +163,8 @@ class MinimaxAgent(MultiAgentSearchAgent):
|
|||||||
Returns whether or not the game state is a losing state
|
Returns whether or not the game state is a losing state
|
||||||
"""
|
"""
|
||||||
"*** YOUR CODE HERE ***"
|
"*** YOUR CODE HERE ***"
|
||||||
return self.result(gameState, 0, self.depth)[1]
|
action = self.result(gameState, 0, self.depth)[1]
|
||||||
|
return action
|
||||||
|
|
||||||
def result(self, state, agentIndex, depth):
|
def result(self, state, agentIndex, depth):
|
||||||
if depth == 0 or state.isLose() or state.isWin():
|
if depth == 0 or state.isLose() or state.isWin():
|
||||||
@ -196,7 +198,8 @@ class AlphaBetaAgent(MultiAgentSearchAgent):
|
|||||||
Returns the minimax action using self.depth and self.evaluationFunction
|
Returns the minimax action using self.depth and self.evaluationFunction
|
||||||
"""
|
"""
|
||||||
"*** YOUR CODE HERE ***"
|
"*** YOUR CODE HERE ***"
|
||||||
return self.result(gameState, 0, self.depth, -1e9, 1e9)[1]
|
action = self.result(gameState, 0, self.depth, -1e9, 1e9)[1]
|
||||||
|
return action
|
||||||
|
|
||||||
def result(self, state, agentIndex, depth, alpha, beta):
|
def result(self, state, agentIndex, depth, alpha, beta):
|
||||||
if depth == 0 or state.isLose() or state.isWin():
|
if depth == 0 or state.isLose() or state.isWin():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user