misc edits

This commit is contained in:
eugenep 2021-04-28 15:30:07 +02:00
parent c2268fefc3
commit 55d542fa0e

View File

@ -7,7 +7,7 @@ from sprites import Direction
class PlanRoute():
""" The problem of moving the Hybrid Wumpus Agent from one place to other """
""" The problem of moving the Agent from one place to other """
def __init__(self, initial, goal, allowed, puddles=None, dimrow=None):
""" Define goal state and initialize a problem """
@ -420,7 +420,7 @@ class SweeperAgent:
@staticmethod
#def best_first_graph_search(problem, f, display=False):
def best_first_graph_search(problem, f, display=True):
#f = memoize(f, 'f')
"""TODO"""
# Zaimplementować klasę Node dla Astar
@ -553,21 +553,3 @@ class Test:
print(orientation)
def memoize(fn, slot=None, maxsize=32):
"""Memoize fn: make it remember the computed value for any argument list.
If slot is specified, store result in that slot of first argument.
If slot is false, use lru_cache for caching the values."""
if slot:
def memoized_fn(obj, *args):
if hasattr(obj, slot):
return getattr(obj, slot)
else:
val = fn(obj, *args)
setattr(obj, slot, val)
return val
else:
@functools.lru_cache(maxsize=maxsize)
def memoized_fn(*args):
return fn(*args)
return memoized_fn