![Reinforcement Learning Snake [ Live Demonstration + Code ]](/images/yt/qf/reinforcement-learning-snake-live-demonstration-code-aojn3.jpg)
Reinforcement Learning Snake [ Live Demonstration + Code ]
Computer learns to plays Snake using Reinforcement Learning
Original Implementation [Code] : https://github.com/python-engineer/snake-ai-pytorch
Please go to this repo for a playlist where the creater codes from scratch
I was bored so I ran it on GPU , Want to improve on this ?
Add more agents , select the best in each generation ...
Or improve the network and increase input information .... CNN ? :)
Lot of to/from device copy overhead , optimize ...
OR you can just find a hamiltonian path which will be boring ( overkill )
So you might want to to follow the hamiltonian path roughly and use a combination of A* and reinforcement learning to make it actually go for the food
BTW there is a typo in agent.py line 135, instead of the nested if it should have been 2 separate if's .
I was able to get 50+ average scores [ Highest score 90+] using 2 additional inputs in about 500 generations and a slightly modified reward system
Please comment suggestions/critics
Enjoy [ and Subscribe ]