From 8b4acab2840ffd805119b63f7f93c7994f9ba9ab Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Thu, 27 Jun 2024 02:12:22 +0000 Subject: [PATCH] finish q8 --- search/searchAgents.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/search/searchAgents.py b/search/searchAgents.py index 4e02258..0a2e4d5 100644 --- a/search/searchAgents.py +++ b/search/searchAgents.py @@ -517,8 +517,7 @@ class ClosestDotSearchAgent(SearchAgent): walls = gameState.getWalls() problem = AnyFoodSearchProblem(gameState) - "*** YOUR CODE HERE ***" - util.raiseNotDefined() + return search.bfs(problem) class AnyFoodSearchProblem(PositionSearchProblem): """ @@ -551,10 +550,7 @@ class AnyFoodSearchProblem(PositionSearchProblem): The state is Pacman's position. Fill this in with a goal test that will complete the problem definition. """ - x,y = state - - "*** YOUR CODE HERE ***" - util.raiseNotDefined() + return state in self.food.asList() def mazeDistance(point1: Tuple[int, int], point2: Tuple[int, int], gameState: pacman.GameState) -> int: """