MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / Cell

Class Cell

machine_learning/astar.py:19–43  ·  view source on GitHub ↗

Class cell represents a cell in the world which have the properties: position: represented by tuple of x and y coordinates initially set to (0,0). parent: Contains the parent cell object visited before we arrived at this cell. g, h, f: Parameters used when calling our heuristic func

Source from the content-addressed store, hash-verified

17
18
19class Cell:
20 """
21 Class cell represents a cell in the world which have the properties:
22 position: represented by tuple of x and y coordinates initially set to (0,0).
23 parent: Contains the parent cell object visited before we arrived at this cell.
24 g, h, f: Parameters used when calling our heuristic function.
25 """
26
27 def __init__(self):
28 self.position = (0, 0)
29 self.parent = None
30 self.g = 0
31 self.h = 0
32 self.f = 0
33
34 """
35 Overrides equals method because otherwise cell assign will give
36 wrong results.
37 """
38
39 def __eq__(self, cell):
40 return self.position == cell.position
41
42 def showcell(self):
43 print(self.position)
44
45
46class Gridworld:

Callers 2

get_neighboursMethod · 0.85
astar.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected