ai-snake-lab 0.1.0__py3-none-any.whl → 0.4.3__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 +243 -86
- ai_snake_lab/ai/AIAgent.py +34 -31
- ai_snake_lab/ai/AITrainer.py +9 -5
- ai_snake_lab/ai/ReplayMemory.py +61 -24
- ai_snake_lab/ai/models/ModelL.py +7 -4
- ai_snake_lab/ai/models/ModelRNN.py +1 -1
- ai_snake_lab/constants/DDb4EPlot.py +20 -0
- ai_snake_lab/constants/DDef.py +1 -1
- ai_snake_lab/constants/DDir.py +4 -1
- ai_snake_lab/constants/DFields.py +6 -0
- ai_snake_lab/constants/DFile.py +2 -1
- ai_snake_lab/constants/DLabels.py +24 -4
- ai_snake_lab/constants/DLayout.py +16 -2
- ai_snake_lab/constants/DModelL.py +4 -0
- ai_snake_lab/constants/DSim.py +20 -0
- ai_snake_lab/game/GameBoard.py +36 -22
- ai_snake_lab/game/SnakeGame.py +17 -0
- ai_snake_lab/ui/Db4EPlot.py +160 -0
- ai_snake_lab/utils/AISim.tcss +81 -38
- {ai_snake_lab-0.1.0.dist-info → ai_snake_lab-0.4.3.dist-info}/METADATA +39 -5
- ai_snake_lab-0.4.3.dist-info/RECORD +31 -0
- {ai_snake_lab-0.1.0.dist-info → ai_snake_lab-0.4.3.dist-info}/WHEEL +1 -1
- {ai_snake_lab-0.1.0.dist-info → ai_snake_lab-0.4.3.dist-info/licenses}/LICENSE +2 -0
- ai_snake_lab-0.1.0.dist-info/RECORD +0 -28
- {ai_snake_lab-0.1.0.dist-info → ai_snake_lab-0.4.3.dist-info}/entry_points.txt +0 -0
ai_snake_lab/utils/AISim.tcss
CHANGED
@@ -1,21 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
Screen {
|
2
|
+
layout: grid;
|
3
|
+
grid-size: 3 4;
|
4
|
+
grid-rows: 3 7 6 11 10;
|
5
|
+
grid-columns: 32 46 30;
|
6
6
|
}
|
7
|
-
|
8
|
-
#
|
9
|
-
|
7
|
+
|
8
|
+
#title {
|
9
|
+
column-span: 3;
|
10
|
+
width: 100%;
|
11
|
+
padding: 0 1;
|
10
12
|
border: round #0c323e;
|
11
|
-
|
12
|
-
|
13
|
+
color: #3e99af;
|
14
|
+
background: black;
|
15
|
+
text-style: bold;
|
16
|
+
align: center middle; }
|
17
|
+
|
18
|
+
#settings_box {
|
19
|
+
border-title-color: #5fc442;
|
20
|
+
border-title-style: bold;
|
21
|
+
border: round #0c323e;
|
22
|
+
padding: 0 1;
|
13
23
|
background: black;
|
14
24
|
}
|
15
25
|
|
16
26
|
#game_box {
|
17
|
-
|
18
|
-
width: 46;
|
27
|
+
row-span: 3;
|
19
28
|
border-title-color: #5fc442;
|
20
29
|
border-subtitle-color: #5fc442;
|
21
30
|
border: round #0c323e;
|
@@ -25,7 +34,6 @@ Button {
|
|
25
34
|
}
|
26
35
|
|
27
36
|
#runtime_box {
|
28
|
-
height: 24;
|
29
37
|
border-title-color: #5fc442;
|
30
38
|
border-title-style: bold;
|
31
39
|
border: round #0c323e;
|
@@ -33,40 +41,48 @@ Button {
|
|
33
41
|
background: black;
|
34
42
|
}
|
35
43
|
|
36
|
-
#
|
37
|
-
|
44
|
+
#filler_1 {
|
45
|
+
}
|
46
|
+
|
47
|
+
#filler_2 {
|
48
|
+
}
|
49
|
+
|
50
|
+
#filler_3 {
|
51
|
+
}
|
52
|
+
|
53
|
+
#game_score_plot {
|
54
|
+
dock: bottom;
|
38
55
|
border: round #0c323e;
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
background: black;
|
56
|
+
height: 15;
|
57
|
+
width: 108;
|
58
|
+
background: black
|
43
59
|
}
|
44
60
|
|
45
|
-
#
|
46
|
-
height: 6;
|
47
|
-
border-title-color: #5fc442;
|
48
|
-
border-title-style: bold;
|
61
|
+
#legend {
|
49
62
|
border: round #0c323e;
|
50
|
-
padding: 0 1;
|
51
|
-
background: black;
|
52
63
|
}
|
53
64
|
|
54
|
-
|
55
|
-
|
56
|
-
padding: 0 1;
|
65
|
+
Button {
|
66
|
+
align: center middle;
|
57
67
|
border: round #0c323e;
|
58
|
-
|
59
|
-
|
68
|
+
width: 10;
|
69
|
+
background: black;
|
70
|
+
}
|
71
|
+
|
72
|
+
#game_board {
|
73
|
+
border: round #0c323e;
|
74
|
+
align: center middle;
|
60
75
|
background: black;
|
61
|
-
|
62
|
-
align: center middle; }
|
76
|
+
}
|
63
77
|
|
64
|
-
|
65
|
-
|
78
|
+
|
79
|
+
|
80
|
+
#button_defaults {
|
81
|
+
color: #3e99af;
|
66
82
|
text-style: bold;
|
67
83
|
}
|
68
84
|
|
69
|
-
#
|
85
|
+
#button_pause {
|
70
86
|
color: #c49b42;
|
71
87
|
text-style: bold;
|
72
88
|
}
|
@@ -76,6 +92,11 @@ Button {
|
|
76
92
|
text-style: bold;
|
77
93
|
}
|
78
94
|
|
95
|
+
#button_restart {
|
96
|
+
color: #3e99af;
|
97
|
+
text-style: bold;
|
98
|
+
}
|
99
|
+
|
79
100
|
#button_quit {
|
80
101
|
color: #c44242;
|
81
102
|
text-style: bold;
|
@@ -91,15 +112,37 @@ Button {
|
|
91
112
|
}
|
92
113
|
|
93
114
|
.label {
|
115
|
+
width: 15;
|
94
116
|
color: #afa73eff;
|
95
117
|
}
|
96
118
|
|
97
|
-
.
|
119
|
+
.label_settings {
|
120
|
+
color: #5fc442;
|
121
|
+
width: 18;
|
122
|
+
}
|
123
|
+
|
124
|
+
.paused #button_pause {
|
98
125
|
display: none;
|
99
126
|
}
|
100
127
|
|
101
|
-
.
|
102
|
-
|
128
|
+
.paused #button_update {
|
129
|
+
display: none;
|
130
|
+
}
|
131
|
+
|
132
|
+
.running #button_reset {
|
133
|
+
display: none;
|
134
|
+
}
|
135
|
+
|
136
|
+
.running #button_restart {
|
137
|
+
display: none;
|
138
|
+
}
|
139
|
+
|
140
|
+
.stopped #button_restart {
|
141
|
+
display: none;
|
142
|
+
}
|
143
|
+
|
144
|
+
.running #button_start {
|
145
|
+
display: none;
|
103
146
|
}
|
104
147
|
|
105
148
|
.stopped #button_pause {
|
@@ -1,8 +1,9 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: ai-snake-lab
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.4.3
|
4
4
|
Summary: Interactive reinforcement learning sandbox for experimenting with AI agents in a classic Snake Game environment.
|
5
5
|
License: GPL-3.0
|
6
|
+
License-File: LICENSE
|
6
7
|
Keywords: AI,Reinforcement Learning,Textual,Snake,Simulation,SQLite,Python
|
7
8
|
Author: Nadim-Daniel Ghaznavi
|
8
9
|
Author-email: nghaznavi@gmail.com
|
@@ -63,8 +64,41 @@ Description-Content-Type: text/markdown
|
|
63
64
|
|
64
65
|
---
|
65
66
|
|
66
|
-
#
|
67
|
+
# Installation
|
68
|
+
|
69
|
+
This project is on [PyPI](https://pypi.org/project/ai-snake-lab/). You can install the *AI Snake Lab* software using `pip`.
|
70
|
+
|
71
|
+
## Create a Sandbox
|
72
|
+
|
73
|
+
```shell
|
74
|
+
python3 -m venv snake_venv
|
75
|
+
. snake_venv/bin/activate
|
76
|
+
```
|
77
|
+
|
78
|
+
## Install the AI Snake Lab
|
79
|
+
|
80
|
+
After you have activated your *venv* environment:
|
81
|
+
|
82
|
+
```shell
|
83
|
+
pip install ai-snake-lab
|
84
|
+
```
|
85
|
+
|
86
|
+
---
|
87
|
+
|
88
|
+
# Running the AI Snake Lab
|
89
|
+
|
90
|
+
From within your *venv* environment:
|
91
|
+
|
92
|
+
```shell
|
93
|
+
ai-snake-lab
|
94
|
+
```
|
95
|
+
|
96
|
+
---
|
97
|
+
|
98
|
+
# Links and Acknowledgements
|
99
|
+
|
100
|
+
This code is based on a YouTube tutorial, [Python + PyTorch + Pygame Reinforcement Learning – Train an AI to Play Snake](https://www.youtube.com/watch?v=L8ypSXwyBds&t=1042s&ab_channel=freeCodeCamp.org) by Patrick Loeber. You can access his original code [here](https://github.com/patrickloeber/snake-ai-pytorch) on GitHub. Thank you Patrick!!! You are amazing!!!!
|
101
|
+
|
102
|
+
Thanks also go out to Will McGugan and the [Textual](https://textual.textualize.io/) team. Textual is an amazing framework. Talk about *rapid Application Development*. Porting this took less than a day.
|
67
103
|
|
68
|
-
* [Project Layout](/pages/project_layout.html)
|
69
|
-
* [SQLite3 Schema](/pages/db_schema.html)
|
70
104
|
---
|
@@ -0,0 +1,31 @@
|
|
1
|
+
ai_snake_lab/AISim.py,sha256=GiqzvU0LAvjjmjP_0JDeak7DAF0R-pEzrPgVpCN-gs8,15148
|
2
|
+
ai_snake_lab/ai/AIAgent.py,sha256=p_O7zC15s_tBcI7oqu60X2-3AbrzAWlGXWkrLVC4UsQ,3005
|
3
|
+
ai_snake_lab/ai/AITrainer.py,sha256=ssX6B03yZLEKhNCJv9D83iFAEEhU3_XbW4sA0z5QMRM,3304
|
4
|
+
ai_snake_lab/ai/EpsilonAlgo.py,sha256=iNVXOqlyjh5vlFePpksR0PTT9M5FDDwJi7P6pYegSrA,2144
|
5
|
+
ai_snake_lab/ai/ReplayMemory.py,sha256=eGdszKKeYuvppmmkA9AtypLRbGZQGZO-uCSHb8qcesw,3986
|
6
|
+
ai_snake_lab/ai/models/ModelL.py,sha256=hK7MoPyIF1_K43R_9xW_MYuaweQGo9qSMUIVrHDQZnQ,1249
|
7
|
+
ai_snake_lab/ai/models/ModelRNN.py,sha256=Ky63BUqJEmwe1PbM4gtjvqd7SmSy_2XA1n-yu8DNexI,1104
|
8
|
+
ai_snake_lab/constants/DDb4EPlot.py,sha256=msudGBXgX6uS5tHr0HXO2b0FhT0hjHkqAWmRMx-79O8,429
|
9
|
+
ai_snake_lab/constants/DDef.py,sha256=PxHFIGZI5XhfG7zS4UpkVWevHm7aZYeGvrV2iq2VN2U,365
|
10
|
+
ai_snake_lab/constants/DDir.py,sha256=5G6Y8XGiBy2v99j7gKpTScqjV0ZozVHhim8uKieIvD4,382
|
11
|
+
ai_snake_lab/constants/DEpsilon.py,sha256=T4B_KMHrCEKsiCx2AgvnXMpQ-V4D2oSCMPkYqw2d-0U,407
|
12
|
+
ai_snake_lab/constants/DFields.py,sha256=v-sdipQwsxw1rOZ6N4W6Xx-MR1TUho5j-mQcj8t6-4U,508
|
13
|
+
ai_snake_lab/constants/DFile.py,sha256=ON0lJXUoop_4n1XRNNOfeLTDckkMYfyLNAn9qznkGX0,365
|
14
|
+
ai_snake_lab/constants/DLabels.py,sha256=Nv7vCs8pxpF6Px5FD3JFkI7KEPWy6G8wLqzv31_nXxw,1501
|
15
|
+
ai_snake_lab/constants/DLayout.py,sha256=xGBrqFk65aIHJp8uYIX8Fg5w_fWizDOiN0khvQeqPiY,1603
|
16
|
+
ai_snake_lab/constants/DModelL.py,sha256=otQZh11qeoy4Bn4e4F1ZTKuT2Pci7Xsl4K01A8pdiVI,493
|
17
|
+
ai_snake_lab/constants/DModelLRNN.py,sha256=gceyvn0-I3XpRL6cUb8Ep67DoybN8bZdDpcXVKf_DCk,432
|
18
|
+
ai_snake_lab/constants/DReplayMemory.py,sha256=DNPn9dFa9piNXpuT6AMx1B96UpoMFXALrYYLjyKwPpU,576
|
19
|
+
ai_snake_lab/constants/DSim.py,sha256=-Yx8Ci_qJLsg5b6y6CBsoi3UqAHN-Wv8qg8jk_AkAJk,497
|
20
|
+
ai_snake_lab/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
|
+
ai_snake_lab/game/GameBoard.py,sha256=VjjNXnZZJ_lTo4bcxflB9TWxi792Do7yMnvL3umrMCc,8452
|
22
|
+
ai_snake_lab/game/GameElements.py,sha256=9vcNH2YWAzYyBZosvj1DzO6ZmUCUMUd8MaIhORWQ8go,470
|
23
|
+
ai_snake_lab/game/SnakeGame.py,sha256=_gyxhLPggPF7B2XvmWLgWP2ywnYWX7QjmwLmi21QuIw,6476
|
24
|
+
ai_snake_lab/ui/Db4EPlot.py,sha256=pcEb0ydXNX2wL0EFBSrqhIoTEhryk4GD0Ua8FFEaZHY,5352
|
25
|
+
ai_snake_lab/utils/AISim.tcss,sha256=XnhqjuxtOiNQHDyXFrbAYSlCw-6ch4e1o52nbytoeF0,2118
|
26
|
+
ai_snake_lab/utils/ConstGroup.py,sha256=ZYyQxFd9PudBUZmc_NsNvWCp___utOe1MptqD3eyVH8,1174
|
27
|
+
ai_snake_lab-0.4.3.dist-info/METADATA,sha256=LGSIuhlhqgl0ZeVVtBebVreZ56FD2h11z9dFgj84Tx0,3689
|
28
|
+
ai_snake_lab-0.4.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
29
|
+
ai_snake_lab-0.4.3.dist-info/entry_points.txt,sha256=VXWDqigE8D35J7scdqjR0EVvOjtP1mm0uS76xMnvodo,56
|
30
|
+
ai_snake_lab-0.4.3.dist-info/licenses/LICENSE,sha256=f-FHFu0xzHH8O_mvKTw2jUZKhTpw6obpmVOI9rnpKeU,35151
|
31
|
+
ai_snake_lab-0.4.3.dist-info/RECORD,,
|
@@ -672,3 +672,5 @@ may consider it more useful to permit linking proprietary applications with
|
|
672
672
|
the library. If this is what you want to do, use the GNU Lesser General
|
673
673
|
Public License instead of this License. But first, please read
|
674
674
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
675
|
+
|
676
|
+
|
@@ -1,28 +0,0 @@
|
|
1
|
-
ai_snake_lab/AISim.py,sha256=9jnWX-JYNqpYxtqb7vf4pbI9tgegrt91QnFWfVU2AFI,10168
|
2
|
-
ai_snake_lab/ai/AIAgent.py,sha256=mwfDwQlm9vRCDlXj5LyIQGtwjZL3j4Fc_L9w79jm2wA,2955
|
3
|
-
ai_snake_lab/ai/AITrainer.py,sha256=VbLfSV3ndplG-KhqpTlUSkoH8lFGGT0auaPjFRzabR0,3169
|
4
|
-
ai_snake_lab/ai/EpsilonAlgo.py,sha256=iNVXOqlyjh5vlFePpksR0PTT9M5FDDwJi7P6pYegSrA,2144
|
5
|
-
ai_snake_lab/ai/ReplayMemory.py,sha256=g8Q_PXiFSL1g4zOEa8pKc9w_x5ijVlG17npYpawL_14,2864
|
6
|
-
ai_snake_lab/ai/models/ModelL.py,sha256=EiTGVag8Sxhoak1sklA4iX4FR65Nlx8m9o-JQNAqOX8,1096
|
7
|
-
ai_snake_lab/ai/models/ModelRNN.py,sha256=jIPK5ZS1olakjQ-9XA6-4EiY70d3RLcKqFqHTZD7cIQ,1104
|
8
|
-
ai_snake_lab/constants/DDef.py,sha256=zyvRkWPrtopKYclbbDGI-1pPAK1h1MyVMdbvhUZPbJY,371
|
9
|
-
ai_snake_lab/constants/DDir.py,sha256=AxmgShKHT5b5WyIlseVHcO7Mwejmyf3hxT62E3RirTg,323
|
10
|
-
ai_snake_lab/constants/DEpsilon.py,sha256=T4B_KMHrCEKsiCx2AgvnXMpQ-V4D2oSCMPkYqw2d-0U,407
|
11
|
-
ai_snake_lab/constants/DFields.py,sha256=Z_whswaGfNIRe9d_9UeXWiWZCB0d48BpM1Wg6tILEa0,357
|
12
|
-
ai_snake_lab/constants/DFile.py,sha256=i6i_K3y90-GgqesN9_zL2NmQu0Vu2VT2V5k7n6QFQR4,328
|
13
|
-
ai_snake_lab/constants/DLabels.py,sha256=5kUrAbYgdJL9zynAjSFQr3FmEvy2CbU0DKRZfwUs71I,883
|
14
|
-
ai_snake_lab/constants/DLayout.py,sha256=T5CeJBaiDST1gaX3ek6TpRJdgETvbl4uk-tlWZah-Y8,1125
|
15
|
-
ai_snake_lab/constants/DModelL.py,sha256=-bb1SMQQE-iGxZcuAGcJv-5xJqtZKsYbmMHwUak11jg,351
|
16
|
-
ai_snake_lab/constants/DModelLRNN.py,sha256=gceyvn0-I3XpRL6cUb8Ep67DoybN8bZdDpcXVKf_DCk,432
|
17
|
-
ai_snake_lab/constants/DReplayMemory.py,sha256=DNPn9dFa9piNXpuT6AMx1B96UpoMFXALrYYLjyKwPpU,576
|
18
|
-
ai_snake_lab/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
-
ai_snake_lab/game/GameBoard.py,sha256=wl2V0cxjqBKHuS1DSx36EE_DRH54tikuhaA9eC5qPsY,7857
|
20
|
-
ai_snake_lab/game/GameElements.py,sha256=9vcNH2YWAzYyBZosvj1DzO6ZmUCUMUd8MaIhORWQ8go,470
|
21
|
-
ai_snake_lab/game/SnakeGame.py,sha256=1YS0xgyzuGQtGgKxDUcPJYM2NV56ekL4OpaOrbpnDW0,5673
|
22
|
-
ai_snake_lab/utils/AISim.tcss,sha256=c0Xq8hjA7YokioZUzJGHhAlX13t2kgelA26hOWtUSVQ,1674
|
23
|
-
ai_snake_lab/utils/ConstGroup.py,sha256=ZYyQxFd9PudBUZmc_NsNvWCp___utOe1MptqD3eyVH8,1174
|
24
|
-
ai_snake_lab-0.1.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
25
|
-
ai_snake_lab-0.1.0.dist-info/METADATA,sha256=X3xDSODxx3q8zlm8GTntrkCa7PL7AbGm-QsDqFgTj8A,2712
|
26
|
-
ai_snake_lab-0.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
27
|
-
ai_snake_lab-0.1.0.dist-info/entry_points.txt,sha256=VXWDqigE8D35J7scdqjR0EVvOjtP1mm0uS76xMnvodo,56
|
28
|
-
ai_snake_lab-0.1.0.dist-info/RECORD,,
|
File without changes
|