ai-snake-lab 0.4.5__py3-none-any.whl → 0.4.6__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.
@@ -129,12 +129,6 @@ class SnakeGame:
129
129
  game_over = True
130
130
  reward = -10
131
131
 
132
- # Set a negative reward if the snake head is adjacent to the snake body.
133
- # This is to discourage snake collisions.
134
- for segment in self.snake[1:]:
135
- if abs(self.head.x - segment.x) < 2 and abs(self.head.y - segment.y) < 2:
136
- reward -= -1
137
-
138
132
  if game_over == True:
139
133
  # Game is over: Snake or wall collision or exceeded max moves
140
134
  self.game_reward += reward
@@ -159,6 +153,12 @@ class SnakeGame:
159
153
  reward -= 2
160
154
  self.distance_to_food = cur_distance
161
155
 
156
+ ## 6. Set a negative reward if the snake head is adjacent to the snake body.
157
+ # This is to discourage snake collisions.
158
+ for segment in self.snake[1:]:
159
+ if abs(self.head.x - segment.x) < 2 and abs(self.head.y - segment.y) < 2:
160
+ reward -= -2
161
+
162
162
  self.game_reward += reward
163
163
  self.game_board.update_snake(snake=self.snake, direction=self.direction)
164
164
  self.game_board.update_food(food=self.food)
@@ -426,6 +426,10 @@ def minutes_to_uptime(seconds: int):
426
426
  return f"{seconds}s"
427
427
 
428
428
 
429
- if __name__ == "__main__":
429
+ def main():
430
430
  app = AISim()
431
431
  app.run()
432
+
433
+
434
+ if __name__ == "__main__":
435
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-snake-lab
3
- Version: 0.4.5
3
+ Version: 0.4.6
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
6
  License-File: LICENSE
@@ -1,4 +1,3 @@
1
- ai_snake_lab/AISim.py,sha256=GiqzvU0LAvjjmjP_0JDeak7DAF0R-pEzrPgVpCN-gs8,15148
2
1
  ai_snake_lab/ai/AIAgent.py,sha256=p_O7zC15s_tBcI7oqu60X2-3AbrzAWlGXWkrLVC4UsQ,3005
3
2
  ai_snake_lab/ai/AITrainer.py,sha256=ssX6B03yZLEKhNCJv9D83iFAEEhU3_XbW4sA0z5QMRM,3304
4
3
  ai_snake_lab/ai/EpsilonAlgo.py,sha256=Q2U_Ow28ZRQn1hlLybWEhB2Gn101x99mrQWupAooRjk,2142
@@ -20,12 +19,13 @@ ai_snake_lab/constants/DSim.py,sha256=ULi_e9g2eBPPZv_swQQoagKLT8dL3gJTwlQihkQk8R
20
19
  ai_snake_lab/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
20
  ai_snake_lab/game/GameBoard.py,sha256=iNgain-8YQg2Ky0GkmGX-ViVmL8P7zPiZYU6Qwrp9Cc,8465
22
21
  ai_snake_lab/game/GameElements.py,sha256=9vcNH2YWAzYyBZosvj1DzO6ZmUCUMUd8MaIhORWQ8go,470
23
- ai_snake_lab/game/SnakeGame.py,sha256=QqAARBGwBZTiuL9zOgl2eDW079ZhankiOyG_zNpou9E,6502
22
+ ai_snake_lab/game/SnakeGame.py,sha256=ADJSVD-bXBruSHf0rzQFh2P9hPWUAnCkQ95B-RFk1vI,6506
23
+ ai_snake_lab/ui/AISim.py,sha256=_XUJtiQ_CMWB7beiXq3o9wgmIL-3QGwjHxy8KbSmd_c,15173
24
24
  ai_snake_lab/ui/Db4EPlot.py,sha256=pcEb0ydXNX2wL0EFBSrqhIoTEhryk4GD0Ua8FFEaZHY,5352
25
25
  ai_snake_lab/utils/AISim.tcss,sha256=XnhqjuxtOiNQHDyXFrbAYSlCw-6ch4e1o52nbytoeF0,2118
26
26
  ai_snake_lab/utils/ConstGroup.py,sha256=ZYyQxFd9PudBUZmc_NsNvWCp___utOe1MptqD3eyVH8,1174
27
- ai_snake_lab-0.4.5.dist-info/METADATA,sha256=cuvVE_sZ9JKVuHoSg-6xZ_INhQxcSfKP9HylFmiN-VE,3689
28
- ai_snake_lab-0.4.5.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
29
- ai_snake_lab-0.4.5.dist-info/entry_points.txt,sha256=VXWDqigE8D35J7scdqjR0EVvOjtP1mm0uS76xMnvodo,56
30
- ai_snake_lab-0.4.5.dist-info/licenses/LICENSE,sha256=f-FHFu0xzHH8O_mvKTw2jUZKhTpw6obpmVOI9rnpKeU,35151
31
- ai_snake_lab-0.4.5.dist-info/RECORD,,
27
+ ai_snake_lab-0.4.6.dist-info/METADATA,sha256=shfnaQS9q3tefXcTuISZbAJRVCGUQ79ivMNrHgDQkKE,3689
28
+ ai_snake_lab-0.4.6.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
29
+ ai_snake_lab-0.4.6.dist-info/entry_points.txt,sha256=ThFx-0yPF5pdwOXUbEo95FEXLUUbOcjfhgMv67PHuIw,59
30
+ ai_snake_lab-0.4.6.dist-info/licenses/LICENSE,sha256=f-FHFu0xzHH8O_mvKTw2jUZKhTpw6obpmVOI9rnpKeU,35151
31
+ ai_snake_lab-0.4.6.dist-info/RECORD,,
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ ai-snake-lab=ai_snake_lab.ui.AISim:main
3
+
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- ai-snake-lab=ai_snake_lab.AISim:main
3
-