Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/armandgiraud/snake
Pure Python Snake +
https://github.com/armandgiraud/snake
Last synced: 6 days ago
JSON representation
Pure Python Snake +
- Host: GitHub
- URL: https://github.com/armandgiraud/snake
- Owner: ArmandGiraud
- Created: 2018-08-21T18:59:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-28T09:29:25.000Z (almost 4 years ago)
- Last Synced: 2024-01-17T20:34:19.339Z (10 months ago)
- Language: Jupyter Notebook
- Size: 5.82 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Snake
---basic infos :bulb:
- Pure Python Snake
- Wall version only for now
- No external lib beyond numpy/cupy## Player Mode
```python
from utils import Snake
sizes = (8, 6) # grid size
sn = Snake(sizes)
```## Bot training Policy Gradient & numpy
```bash
python snake_rl.py
```## Display game every n iteration
```bash
python snake_rl.py -d
```### Coming soon
- pytorch version with GPU support
- pygames interface
- new RL algos----
## Simple Grid format:[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 2, 2, 3, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 4, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
:paperclip: Digits meaning:
- 1: wall, grid borders
- 3: Snake head
- 2: snake body
- 4: snake food:paperclip: reward:
- 10 grab a food piece
- 1 did not crash