Skip to content

Commit

Permalink
Fix formatting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamStrickland committed Oct 19, 2024
1 parent c71b89e commit 6ee78e9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
from .randomized_reflex_agent import RandomizedReflexAgent
from .reflex_vacuum_agent import reflex_vacuum_agent
from .simple_reflex_agent import SimpleReflexAgent

__all__ = [
"ModelBasedReflexAgent",
"RandomizedReflexAgent",
"reflex_vacuum_agent",
"SimpleReflexAgent",
]
12 changes: 12 additions & 0 deletions src/algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@
from .expand import expand
from .iterative_deepening_search import iterative_deepening_search
from .ucs import uniform_cost_search

__all__ = [
"best_first_search",
"bibf_search",
"breadth_first_search",
"depth",
"depth_limited_search",
"is_cycle",
"expand",
"iterative_deepening_search",
"uniform_cost_search",
]
4 changes: 2 additions & 2 deletions src/algorithms/depth_limited_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def is_cycle(node: Node) -> bool:
return False


def depth_limited_search(problem: Problem, l: int) -> Node | str | None:
def depth_limited_search(problem: Problem, l_depth: int) -> Node | str | None:
"""Expands the root node, the next child, repeating this process
until the depth limit is reached, then backtracking to the next
successor of the root. This process is repeated until a goal is
Expand All @@ -70,7 +70,7 @@ def depth_limited_search(problem: Problem, l: int) -> Node | str | None:
if problem.is_goal(node.state):
return node

if depth(node) > l:
if depth(node) > l_depth:
result = "cutoff"
elif not is_cycle(node):
for child in expand(problem, node):
Expand Down
9 changes: 9 additions & 0 deletions src/data_structures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@
from .priority_queue import PriorityQueue
from .problem import Problem
from .sensor import Sensor

__all__ = [
"Actuator",
"Environment",
"Node",
"PriorityQueue",
"Problem",
"Sensor",
]
6 changes: 3 additions & 3 deletions test/data_structures/test_priority_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_pop(self) -> None:
assert self._queue.is_empty()

def test_top(self) -> None:
assert self._queue.top() == None
assert self._queue.top() is None

A = Node(state={}, parent=None, action="None", path_cost=0)
self._queue.add(A)
Expand All @@ -52,13 +52,13 @@ def test_top(self) -> None:

def test_add(self) -> None:
while not self._queue.is_empty():
node = self._queue.pop()
_ = self._queue.pop()

A = Node(state={}, parent=None, action="None", path_cost=0)
B = Node(state={}, parent=None, action="None", path_cost=1)
C = Node(state={}, parent=None, action="None", path_cost=2)

assert self._queue.top() == None
assert self._queue.top() is None

self._queue.add(C)

Expand Down

0 comments on commit 6ee78e9

Please sign in to comment.