ai-snake-lab 0.1.0__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.
- ai_snake_lab/AISim.py +274 -0
- ai_snake_lab/ai/AIAgent.py +84 -0
- ai_snake_lab/ai/AITrainer.py +90 -0
- ai_snake_lab/ai/EpsilonAlgo.py +73 -0
- ai_snake_lab/ai/ReplayMemory.py +90 -0
- ai_snake_lab/ai/models/ModelL.py +40 -0
- ai_snake_lab/ai/models/ModelRNN.py +43 -0
- ai_snake_lab/constants/DDef.py +18 -0
- ai_snake_lab/constants/DDir.py +16 -0
- ai_snake_lab/constants/DEpsilon.py +19 -0
- ai_snake_lab/constants/DFields.py +18 -0
- ai_snake_lab/constants/DFile.py +17 -0
- ai_snake_lab/constants/DLabels.py +34 -0
- ai_snake_lab/constants/DLayout.py +39 -0
- ai_snake_lab/constants/DModelL.py +17 -0
- ai_snake_lab/constants/DModelLRNN.py +20 -0
- ai_snake_lab/constants/DReplayMemory.py +25 -0
- ai_snake_lab/constants/__init__.py +0 -0
- ai_snake_lab/game/GameBoard.py +221 -0
- ai_snake_lab/game/GameElements.py +27 -0
- ai_snake_lab/game/SnakeGame.py +178 -0
- ai_snake_lab/utils/AISim.tcss +115 -0
- ai_snake_lab/utils/ConstGroup.py +49 -0
- ai_snake_lab-0.1.0.dist-info/LICENSE +674 -0
- ai_snake_lab-0.1.0.dist-info/METADATA +70 -0
- ai_snake_lab-0.1.0.dist-info/RECORD +28 -0
- ai_snake_lab-0.1.0.dist-info/WHEEL +4 -0
- ai_snake_lab-0.1.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
Button {
|
2
|
+
align: center middle;
|
3
|
+
border: round #0c323e;
|
4
|
+
width: 10;
|
5
|
+
background: black;
|
6
|
+
}
|
7
|
+
|
8
|
+
#game_board {
|
9
|
+
height: 22;
|
10
|
+
border: round #0c323e;
|
11
|
+
width: 42;
|
12
|
+
align: center middle;
|
13
|
+
background: black;
|
14
|
+
}
|
15
|
+
|
16
|
+
#game_box {
|
17
|
+
height: 24;
|
18
|
+
width: 46;
|
19
|
+
border-title-color: #5fc442;
|
20
|
+
border-subtitle-color: #5fc442;
|
21
|
+
border: round #0c323e;
|
22
|
+
background: black;
|
23
|
+
align: center middle;
|
24
|
+
padding: 0 1;
|
25
|
+
}
|
26
|
+
|
27
|
+
#runtime_box {
|
28
|
+
height: 24;
|
29
|
+
border-title-color: #5fc442;
|
30
|
+
border-title-style: bold;
|
31
|
+
border: round #0c323e;
|
32
|
+
padding: 0 1;
|
33
|
+
background: black;
|
34
|
+
}
|
35
|
+
|
36
|
+
#score {
|
37
|
+
height: 3;
|
38
|
+
border: round #0c323e;
|
39
|
+
width: 42;
|
40
|
+
padding: 0 1;
|
41
|
+
color: #5fc442;
|
42
|
+
background: black;
|
43
|
+
}
|
44
|
+
|
45
|
+
#settings_box {
|
46
|
+
height: 6;
|
47
|
+
border-title-color: #5fc442;
|
48
|
+
border-title-style: bold;
|
49
|
+
border: round #0c323e;
|
50
|
+
padding: 0 1;
|
51
|
+
background: black;
|
52
|
+
}
|
53
|
+
|
54
|
+
#title {
|
55
|
+
height: 3;
|
56
|
+
padding: 0 1;
|
57
|
+
border: round #0c323e;
|
58
|
+
color: #3e99af;
|
59
|
+
width: 100%;
|
60
|
+
background: black;
|
61
|
+
text-style: bold;
|
62
|
+
align: center middle; }
|
63
|
+
|
64
|
+
#button_pause {
|
65
|
+
color: #c44242;
|
66
|
+
text-style: bold;
|
67
|
+
}
|
68
|
+
|
69
|
+
#button_reset {
|
70
|
+
color: #c49b42;
|
71
|
+
text-style: bold;
|
72
|
+
}
|
73
|
+
|
74
|
+
#button_start {
|
75
|
+
color: #5fc442;
|
76
|
+
text-style: bold;
|
77
|
+
}
|
78
|
+
|
79
|
+
#button_quit {
|
80
|
+
color: #c44242;
|
81
|
+
text-style: bold;
|
82
|
+
}
|
83
|
+
|
84
|
+
#button_update {
|
85
|
+
color: #3e99af;
|
86
|
+
text-style: bold;
|
87
|
+
}
|
88
|
+
|
89
|
+
.input_10 {
|
90
|
+
width: 10;
|
91
|
+
}
|
92
|
+
|
93
|
+
.label {
|
94
|
+
color: #afa73eff;
|
95
|
+
}
|
96
|
+
|
97
|
+
.running #button_start {
|
98
|
+
display: none;
|
99
|
+
}
|
100
|
+
|
101
|
+
.label_settings {
|
102
|
+
color: #5fc442;
|
103
|
+
}
|
104
|
+
|
105
|
+
.stopped #button_pause {
|
106
|
+
display: none;
|
107
|
+
}
|
108
|
+
|
109
|
+
.stopped #button_update {
|
110
|
+
display: none;
|
111
|
+
}
|
112
|
+
.variable {
|
113
|
+
color: #afa73eff
|
114
|
+
}
|
115
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"""
|
2
|
+
Widgets/TopBar.py
|
3
|
+
|
4
|
+
AI Snake Game Simulator
|
5
|
+
Author: Nadim-Daniel Ghaznavi
|
6
|
+
Copyright: (c) 2024-2025 Nadim-Daniel Ghaznavi
|
7
|
+
GitHub: https://github.com/NadimGhaznavi/ai
|
8
|
+
License: GPL 3.0
|
9
|
+
"""
|
10
|
+
|
11
|
+
|
12
|
+
class MetaConst(type):
|
13
|
+
"""Metaclass that collects public attributes into a dictionary-like mapping."""
|
14
|
+
|
15
|
+
def __new__(mcs, name, bases, namespace):
|
16
|
+
cls = super().__new__(mcs, name, bases, namespace)
|
17
|
+
cls._constants = {
|
18
|
+
k: v
|
19
|
+
for k, v in namespace.items()
|
20
|
+
if not k.startswith("_") and not callable(v)
|
21
|
+
}
|
22
|
+
return cls
|
23
|
+
|
24
|
+
def __getitem__(cls, key):
|
25
|
+
return cls._constants[key]
|
26
|
+
|
27
|
+
def keys(cls):
|
28
|
+
return cls._constants.keys()
|
29
|
+
|
30
|
+
def values(cls):
|
31
|
+
return cls._constants.values()
|
32
|
+
|
33
|
+
def items(cls):
|
34
|
+
return cls._constants.items()
|
35
|
+
|
36
|
+
def __iter__(cls):
|
37
|
+
return iter(cls._constants)
|
38
|
+
|
39
|
+
def __contains__(cls, item):
|
40
|
+
return item in cls._constants
|
41
|
+
|
42
|
+
def __repr__(cls):
|
43
|
+
return f"<ConstGroup {cls.__name__}: {cls._constants!r}>"
|
44
|
+
|
45
|
+
|
46
|
+
class ConstGroup(metaclass=MetaConst):
|
47
|
+
"""Base class for constant groups (dict + namespace)."""
|
48
|
+
|
49
|
+
pass
|