co2114 2025.2.2__py3-none-any.whl → 2026.0.2__py3-none-any.whl
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.
- co2114/agent/environment.py +300 -134
- co2114/agent/things.py +34 -10
- co2114/engine.py +114 -37
- co2114/search/graph.py +278 -129
- co2114/search/things.py +38 -14
- co2114/util/__init__.py +35 -11
- {co2114-2025.2.2.dist-info → co2114-2026.0.2.dist-info}/METADATA +4 -3
- {co2114-2025.2.2.dist-info → co2114-2026.0.2.dist-info}/RECORD +11 -11
- {co2114-2025.2.2.dist-info → co2114-2026.0.2.dist-info}/WHEEL +1 -1
- {co2114-2025.2.2.dist-info → co2114-2026.0.2.dist-info/licenses}/LICENSE +0 -0
- {co2114-2025.2.2.dist-info → co2114-2026.0.2.dist-info}/top_level.txt +0 -0
co2114/util/__init__.py
CHANGED
|
@@ -1,29 +1,53 @@
|
|
|
1
1
|
__all__ = ["colours", "fonts"]
|
|
2
2
|
|
|
3
|
+
from typing import Iterator, Iterable, TypeVar, override, Generic
|
|
4
|
+
from numbers import Complex
|
|
5
|
+
|
|
3
6
|
from collections import deque
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
Number = TypeVar("Number", int, float)
|
|
9
|
+
DataType = TypeVar("DataType")
|
|
10
|
+
|
|
11
|
+
class queue(Generic[DataType]):
|
|
12
|
+
""" A simple queue class """
|
|
13
|
+
def __init__(self) -> None:
|
|
14
|
+
""" Initialise queue """
|
|
15
|
+
self.data: deque[DataType] = deque() # double-ended queue
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+
@override
|
|
18
|
+
def __repr__(self) -> str:
|
|
19
|
+
""" String representation of queue
|
|
20
|
+
|
|
21
|
+
Returns string of list of data in queue
|
|
22
|
+
"""
|
|
10
23
|
return str(list(self.data))
|
|
11
|
-
|
|
12
|
-
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def __iter__(self) -> Iterator[DataType]:
|
|
27
|
+
""" Iterator for queue """
|
|
13
28
|
return iter(self.data)
|
|
14
29
|
|
|
15
|
-
|
|
30
|
+
|
|
31
|
+
def push(self, x:DataType) -> None:
|
|
32
|
+
""" Push item onto back of queue """
|
|
16
33
|
self.data.append(x)
|
|
17
34
|
|
|
18
|
-
|
|
35
|
+
|
|
36
|
+
def pop(self) -> DataType:
|
|
37
|
+
""" Pop item from front of queue """
|
|
19
38
|
return self.data.popleft()
|
|
20
39
|
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
|
|
41
|
+
class stack(queue[DataType]):
|
|
42
|
+
""" A simple stack class """
|
|
43
|
+
@override
|
|
44
|
+
def pop(self) -> DataType:
|
|
45
|
+
""" Pop item from top of stack """
|
|
23
46
|
return self.data.pop()
|
|
24
47
|
|
|
25
48
|
|
|
26
|
-
def manhattan(a, b):
|
|
49
|
+
def manhattan(a:tuple[Number, Number], b:tuple[Number, Number]) -> Number:
|
|
50
|
+
""" Compute Manhattan distance between two (x, y) locations """
|
|
27
51
|
ax, ay = a # (x, y)
|
|
28
52
|
bx, by = b # (x, y)
|
|
29
53
|
return abs(bx-ax) + abs(by-ay)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: co2114
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2026.0.2
|
|
4
4
|
Summary: codebase for co2114
|
|
5
5
|
Author: wil ward
|
|
6
|
-
Requires-Python: >=3.
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
7
|
License-File: LICENSE
|
|
8
8
|
Requires-Dist: pygame>=2.6
|
|
9
9
|
Requires-Dist: numpy
|
|
@@ -13,6 +13,7 @@ Requires-Dist: jupyter
|
|
|
13
13
|
Requires-Dist: scikit-learn
|
|
14
14
|
Requires-Dist: seaborn
|
|
15
15
|
Dynamic: author
|
|
16
|
+
Dynamic: license-file
|
|
16
17
|
Dynamic: requires-dist
|
|
17
18
|
Dynamic: requires-python
|
|
18
19
|
Dynamic: summary
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
co2114/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
co2114/engine.py,sha256=
|
|
2
|
+
co2114/engine.py,sha256=zN_jNil7xN52K9yJMTmEPARrL53kKwb_zg1BM6Cl6Jw,7043
|
|
3
3
|
co2114/agent/__init__.py,sha256=4dQXJw6n6SJk3YDVtuRYuZjZvOIFfk6BkXfBA6UXLZg,34
|
|
4
|
-
co2114/agent/environment.py,sha256=
|
|
5
|
-
co2114/agent/things.py,sha256=
|
|
4
|
+
co2114/agent/environment.py,sha256=evDK7DulNHRv3llVXSuABzSWSxDLhLsMrKLOJjLSUKQ,18363
|
|
5
|
+
co2114/agent/things.py,sha256=UUzwozCwmvqMIPSI9V3Fx-FmcCGiybxRhM6Mb1TqZcs,2278
|
|
6
6
|
co2114/constraints/__init__.py,sha256=yDE8UZkEPk26YZRiBt-Rv3tZSfkoWo7T5zs2aTklyec,36
|
|
7
7
|
co2114/constraints/magic.py,sha256=63iueMhdZyxImTkJ7lAMPalnun0ZeG3XrpSY2vzLLmM,3225
|
|
8
8
|
co2114/constraints/sudoku.py,sha256=3Tp8khLY0cJch9_xn59G6kug0UZCYHCbFXyCPue5nSI,3456
|
|
@@ -17,15 +17,15 @@ co2114/reasoning/cluedo.py,sha256=rMqrI_BDDiO0fWgOkhFuOOcB4dCl3Pf9OZEsmJ8safs,14
|
|
|
17
17
|
co2114/reasoning/inference.py,sha256=j5NGkxdKS3jacBJUVxOnwquMY9Pm4nEt5JkxeyBV2CE,4625
|
|
18
18
|
co2114/reasoning/logic.py,sha256=tQ5gLsczU_j9ATanA7uHHLdfxmW--VUO7u-78LJAgmY,10531
|
|
19
19
|
co2114/search/__init__.py,sha256=UxLSQsWU2Q8WKBXb7cAqhR-NFRMf3_t7XPIO7oOGB8Y,45
|
|
20
|
-
co2114/search/graph.py,sha256=
|
|
20
|
+
co2114/search/graph.py,sha256=JPtURul_PaE-zP0KTZSXCDOl2zRQ4nrqfonAf6sEvJU,17259
|
|
21
21
|
co2114/search/maze.py,sha256=yveUVwQNtV3v8EGlAilSepZKgVbcd2bYt3GcATqrOVA,9947
|
|
22
|
-
co2114/search/things.py,sha256=
|
|
22
|
+
co2114/search/things.py,sha256=hdWq_2uTM1X603-QOcr5QEyo1CeEWbnOhILem0yd-Fg,1783
|
|
23
23
|
co2114/search/util.py,sha256=J2SHFn7NuSMIbepjnI6PkkOt03f9qxi50Pw5rnA42IU,532
|
|
24
|
-
co2114/util/__init__.py,sha256=
|
|
24
|
+
co2114/util/__init__.py,sha256=5FC5sdGxQjrXI_tXBohVs2Vrsi-rP0sEz-ReGgf0tYw,1429
|
|
25
25
|
co2114/util/colours.py,sha256=ipS3jGhiomhyRdQcdGhywIhxRBRbBIx6QboqPcL3GMs,757
|
|
26
26
|
co2114/util/fonts.py,sha256=iL9al4B3F_w7EMG2lw7iLU4jA3uSqenMYY4zjhojtRk,504
|
|
27
|
-
co2114-
|
|
28
|
-
co2114-
|
|
29
|
-
co2114-
|
|
30
|
-
co2114-
|
|
31
|
-
co2114-
|
|
27
|
+
co2114-2026.0.2.dist-info/licenses/LICENSE,sha256=9KBazlyiIjZEG_wmBd9vkJZ0K0G7lsEX874rHL89FVs,1090
|
|
28
|
+
co2114-2026.0.2.dist-info/METADATA,sha256=ZBrBYFn5Bj0vnc1PzxSVIahPUAioLU8PaQYQRtTZ8KY,438
|
|
29
|
+
co2114-2026.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
co2114-2026.0.2.dist-info/top_level.txt,sha256=IrtPs7QmoV3CNxGgxSDrfx8VUgDdkbMaO6uVmutU9kg,7
|
|
31
|
+
co2114-2026.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|