co2114 2026.0.2__tar.gz → 2026.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {co2114-2026.0.2 → co2114-2026.1.0}/PKG-INFO +1 -1
  2. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/agent/environment.py +13 -0
  3. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/engine.py +3 -5
  4. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/search/graph.py +19 -5
  5. {co2114-2026.0.2 → co2114-2026.1.0}/co2114.egg-info/PKG-INFO +1 -1
  6. {co2114-2026.0.2 → co2114-2026.1.0}/setup.py +1 -1
  7. {co2114-2026.0.2 → co2114-2026.1.0}/LICENSE +0 -0
  8. {co2114-2026.0.2 → co2114-2026.1.0}/README.md +0 -0
  9. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/__init__.py +0 -0
  10. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/agent/__init__.py +0 -0
  11. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/agent/things.py +0 -0
  12. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/constraints/__init__.py +0 -0
  13. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/constraints/csp/__init__.py +0 -0
  14. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/constraints/csp/util.py +0 -0
  15. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/constraints/magic.py +0 -0
  16. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/constraints/sudoku.py +0 -0
  17. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/optimisation/__init__.py +0 -0
  18. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/optimisation/minimax.py +0 -0
  19. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/optimisation/planning.py +0 -0
  20. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/optimisation/things.py +0 -0
  21. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/reasoning/__init__.py +0 -0
  22. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/reasoning/cluedo.py +0 -0
  23. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/reasoning/inference.py +0 -0
  24. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/reasoning/logic.py +0 -0
  25. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/search/__init__.py +0 -0
  26. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/search/maze.py +0 -0
  27. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/search/things.py +0 -0
  28. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/search/util.py +0 -0
  29. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/util/__init__.py +0 -0
  30. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/util/colours.py +0 -0
  31. {co2114-2026.0.2 → co2114-2026.1.0}/co2114/util/fonts.py +0 -0
  32. {co2114-2026.0.2 → co2114-2026.1.0}/co2114.egg-info/SOURCES.txt +0 -0
  33. {co2114-2026.0.2 → co2114-2026.1.0}/co2114.egg-info/dependency_links.txt +0 -0
  34. {co2114-2026.0.2 → co2114-2026.1.0}/co2114.egg-info/requires.txt +0 -0
  35. {co2114-2026.0.2 → co2114-2026.1.0}/co2114.egg-info/top_level.txt +0 -0
  36. {co2114-2026.0.2 → co2114-2026.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: co2114
3
- Version: 2026.0.2
3
+ Version: 2026.1.0
4
4
  Summary: codebase for co2114
5
5
  Author: wil ward
6
6
  Requires-Python: >=3.12
@@ -26,10 +26,21 @@ class BaseEnvironment:
26
26
  """ Base Environment
27
27
  Adapted from AIMI code
28
28
  """
29
+ def __init__(self):
30
+ """ Base constructor """
31
+ self.__counter: int = 0
32
+
29
33
  def __repr__(self) -> str:
30
34
  """ Base string representation """
31
35
  return self.__class__.__name__
32
36
 
37
+ @property
38
+ def counter(self) -> int:
39
+ """ Tracker for number of iterations completed.
40
+ :return counter: Number of iterations in runtime simulation
41
+ """
42
+ return self.__counter
43
+
33
44
  @property
34
45
  def is_done(self) -> bool:
35
46
  """ Property indicating completion of simulation, needs overriding
@@ -54,6 +65,7 @@ class BaseEnvironment:
54
65
  print(f"{self}: Running for {steps} iterations.")
55
66
 
56
67
  for i in range(steps):
68
+ self.__counter += 1
57
69
  if self.is_done: # print terination message and exit
58
70
  print(f"{self}: Simulation complete after {i} of {steps} iterations.")
59
71
  return
@@ -67,6 +79,7 @@ class Environment(BaseEnvironment):
67
79
  """
68
80
  def __init__(self):
69
81
  """ Initialises set of things and agents """
82
+ super().__init__()
70
83
  self.things = set() # all things in environment
71
84
  self.agents = set() # all agents in environment
72
85
 
@@ -106,7 +106,6 @@ class Engine(BaseEngine):
106
106
 
107
107
  def _update(self) -> None:
108
108
  """ Processing loop internals """
109
-
110
109
  # frame limiter
111
110
  if self._framerate is None or not isinstance(self._framerate, int):
112
111
  self._framerate = DEFAULT_FPS # corrective measures
@@ -134,7 +133,6 @@ class Engine(BaseEngine):
134
133
  def update(self) -> None:
135
134
  """ Main process loop, needs override """
136
135
  raise NotImplementedError
137
-
138
136
 
139
137
  def render(self) -> None:
140
138
  """ Main render loop, needs override """
@@ -165,7 +163,7 @@ class App(Engine):
165
163
  @classmethod
166
164
  def run_default(cls) -> None:
167
165
  """ Run the app with default parameters """
168
- app = App()
166
+ app = cls()
169
167
  app.run()
170
168
 
171
169
 
@@ -191,7 +189,7 @@ class ClockApp(App):
191
189
  self._font = pygame.font.SysFont(TEXT_FONT, 128) # override font
192
190
  self.t = datetime.now() # current time
193
191
 
194
- @override
192
+ # @override
195
193
  def update(self) -> None:
196
194
  """ Main process loop
197
195
 
@@ -199,7 +197,7 @@ class ClockApp(App):
199
197
  """
200
198
  self.t = datetime.now() # get current time
201
199
 
202
- @override
200
+ # @override
203
201
  def render(self) -> None:
204
202
  """ Main render loop
205
203
 
@@ -18,7 +18,7 @@ Label = str
18
18
  # Weight = Numeric
19
19
 
20
20
  # Example graph dictionary representing UK cities and distances between them
21
- UK_CITIES_GRAPH:dict[str, Iterable[str | tuple[str,str] | int]] = {
21
+ UK_CITIES_GRAPH:dict[str, Iterable[str | tuple[str,str] | tuple[Numeric, Numeric] | int]] = {
22
22
  "nodes": ["Edinburgh", "Glasgow", "Manchester", "Liverpool",
23
23
  "Newcastle", "York", "Sheffield", "Leicester",
24
24
  "London", "Bath", "Bristol", "Exeter", "Cardiff", "Birmingham"],
@@ -32,8 +32,13 @@ UK_CITIES_GRAPH:dict[str, Iterable[str | tuple[str,str] | int]] = {
32
32
  ("Birmingham", "Cardiff"), ("Leicester", "London"),
33
33
  ("Birmingham", "Leicester"),
34
34
  ("Birmingham", "London"), ("Birmingham", "Bristol"),
35
- ("London", "Bristol"), ("Cardiff", "Bristol")],
36
- "weights": [2,4,1,1,4,1,1,2,1,3,3,2,1,2,5,1,2,2,3,2,1]
35
+ ("London", "Bristol"), ("Cardiff", "Bristol"), ("Bristol", "Bath"), ("Exeter", "Bristol"), ("Exeter", "London")],
36
+ "weights": [2,4,1,1,4,1,1,2,1,3,3,2,1,2,5,1,2,2,3,2,1,1,2,5],
37
+ "locations": [(55.9533, -3.1883), (55.8617, -4.2583), (53.4808, -2.2426),
38
+ (53.4084, -2.9916), (54.9783, -1.6178), (53.9614, -1.0739),
39
+ (53.3811, -1.4701), (52.6369, -1.1398), (51.5072, -0.1276),
40
+ (51.3781, -2.3597), (51.4545, -2.5879), (50.7260, -3.5275),
41
+ (51.4837, -3.1681), (52.4823, -1.8900)]
37
42
  }
38
43
 
39
44
 
@@ -188,13 +193,16 @@ class GraphEnvironment(Environment):
188
193
  super().__init__(*args, **kwargs) # initialize base Environment
189
194
  self.graph = graph if isinstance(graph, Graph) else Graph()
190
195
 
191
-
192
- def add_node(self, node:Node) -> None:
196
+
197
+ def add_node(self, node:Node, location:None | tuple = None) -> None:
193
198
  """ Add a node to the graph environment.
194
199
 
195
200
  :param node: Node to be added to the graph.
201
+ :param location: Optional location information of node, default None
196
202
  """
197
203
  self.graph.add_node(node)
204
+ if location is not None:
205
+ node.location = location
198
206
 
199
207
 
200
208
  @override
@@ -286,6 +294,12 @@ class GraphEnvironment(Environment):
286
294
  a, b = edge # type: ignore
287
295
  nodes[a].add_neighbour(nodes[b], weight) # add edge with weight
288
296
 
297
+ if 'locations' in graph_dict:
298
+ locations = graph_dict['locations']
299
+ else:
300
+ locations = [(0,0)]*len(nodes)
301
+ for key, location in zip(nodes, locations):
302
+ nodes[key].location = location # type: ignore
289
303
 
290
304
  # create environment and add nodes
291
305
  environment = cls()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: co2114
3
- Version: 2026.0.2
3
+ Version: 2026.1.0
4
4
  Summary: codebase for co2114
5
5
  Author: wil ward
6
6
  Requires-Python: >=3.12
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name="co2114",
5
- version="2026.0.2",
5
+ version="2026.1.0",
6
6
  description="codebase for co2114",
7
7
  author="wil ward",
8
8
  python_requires=">=3.12",
File without changes
File without changes
File without changes
File without changes