{"repo":"chynl/snake","free":true,"listed":false,"github":"https://github.com/chynl/snake","clone":"git clone https://github.com/chynl/snake.git","description":"Playing the game of snake with AI.","language":"Python","stars":1784,"topics":["snake","game","artificial-intelligence","graph-theory","algorithm","python","deep-reinforcement-learning","reinforcement-learning","ai","snake-ai"],"license":"MIT","category":"game-templates","readme_excerpt":"Snake This project implements two AI algorithms to play the game of snake): Algorithm Example Average Length Success Rate :-------: :-----: :-------------: :-----------: Graph Search 35.86 94% Reinforcement Learning 29.33 50% \\ Average Length: Average length of the snake before the game ends. The game ends when the snake hits itself or the wall, or consumes all the food and reaches the max length. The game grid is 6x6, so the max length is 36. The average is computed over 1000 rounds. \\ Success Rate: Success means the snake is able to consume all the food and reach the max length without hitting itself or the wall. The rate is computed over 1000 rounds. Installation The project requires Python = 3.10. Create a virtual environment first: Install mandatory dependencies: Play the game with graph search (append -h to see all supported options): Optional: To play the game with reinforcement learning or train the reinforcement learning model, please install PyTorch based on your CPU/GPU preference. The program supports both CPU and GPU. Run the command below to play the game with reinforcement learning: The pre-trained reinforcement learning model is available here. Run the command below to train your own model: Algorithms Two algorithms are implemented to play the game. The first algorithm is based on graph search, providing a rule-based strategy for different situations. The second algorithm is based on reinforcement learning, where the snake learns to play the game by trial and ","default_branch":null,"files":null,"tree":[],"storefront":"/r/chynl","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/chynl/snake/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}