From 2bfaff8a3031295856c70019865fa78b8951f949 Mon Sep 17 00:00:00 2001 From: korzepadawid Date: Mon, 11 Apr 2022 23:56:35 +0200 Subject: [PATCH] update: changed variable name in a_star.py --- algorithms/a_star.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/algorithms/a_star.py b/algorithms/a_star.py index 524eca5..0d3ba5f 100644 --- a/algorithms/a_star.py +++ b/algorithms/a_star.py @@ -94,41 +94,41 @@ def remove_forward(possible_actions: List[str]) -> None: def result(state: State, action: str) -> State: - new_state = State(state.position, state.direction) + next_state = State(state.position, state.direction) if state.direction == UP: if action == TURN_LEFT: - new_state.direction = LEFT + next_state.direction = LEFT elif action == TURN_RIGHT: - new_state.direction = RIGHT + next_state.direction = RIGHT elif action == FORWARD: - new_state.position = next_position(state.position, UP) + next_state.position = next_position(state.position, UP) elif state.direction == DOWN: if action == TURN_LEFT: - new_state.direction = RIGHT + next_state.direction = RIGHT elif action == TURN_RIGHT: - new_state.direction = LEFT + next_state.direction = LEFT elif action == FORWARD: - new_state.position = next_position(state.position, DOWN) + next_state.position = next_position(state.position, DOWN) elif state.direction == LEFT: if action == TURN_LEFT: - new_state.direction = DOWN + next_state.direction = DOWN elif action == TURN_RIGHT: - new_state.direction = UP + next_state.direction = UP elif action == FORWARD: - new_state.position = next_position(state.position, LEFT) + next_state.position = next_position(state.position, LEFT) elif state.direction == RIGHT: if action == TURN_LEFT: - new_state.direction = UP + next_state.direction = UP elif action == TURN_RIGHT: - new_state.direction = DOWN + next_state.direction = DOWN elif action == FORWARD: - new_state.position = next_position(state.position, RIGHT) + next_state.position = next_position(state.position, RIGHT) - return new_state + return next_state def goal_test(state: State, goal_list: List[Tuple[int, int]]) -> bool: