{"id":13632126,"url":"https://github.com/chuyangliu/snake","last_synced_at":"2025-05-14T12:12:55.248Z","repository":{"id":43174619,"uuid":"61924149","full_name":"chuyangliu/snake","owner":"chuyangliu","description":"Artificial intelligence for the Snake game.","archived":false,"fork":false,"pushed_at":"2025-02-28T18:10:18.000Z","size":4103,"stargazers_count":1705,"open_issues_count":0,"forks_count":505,"subscribers_count":106,"default_branch":"main","last_synced_at":"2025-04-11T05:59:35.700Z","etag":null,"topics":["ai","algorithm","artificial-intelligence","deep-reinforcement-learning","game","graph-theory","python","reinforcement-learning","snake","snake-ai"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chuyangliu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-25T02:59:09.000Z","updated_at":"2025-04-09T14:12:07.000Z","dependencies_parsed_at":"2023-02-10T19:46:16.333Z","dependency_job_id":"773a094a-a526-4f5c-b70e-b8f7b7727f41","html_url":"https://github.com/chuyangliu/snake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyangliu%2Fsnake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyangliu%2Fsnake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyangliu%2Fsnake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chuyangliu%2Fsnake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chuyangliu","download_url":"https://codeload.github.com/chuyangliu/snake/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254140769,"owners_count":22021220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","algorithm","artificial-intelligence","deep-reinforcement-learning","game","graph-theory","python","reinforcement-learning","snake","snake-ai"],"created_at":"2024-08-01T22:02:52.773Z","updated_at":"2025-05-14T12:12:50.225Z","avatar_url":"https://github.com/chuyangliu.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Snake\n\nThe project focuses on the artificial intelligence of the [Snake][snake-wiki] game. The snake's goal is to eat the food continuously and fill the map with its bodies as soon as possible. Originally, the project was [written in C++][snake-cpp]. It has now been rewritten in Python for a user-friendly GUI and the simplicity in algorithm implementations.\n\n***[Algorithms \u003e][doc-algorithms]***\n\n## Experiments\n\nWe use two metrics to evaluate the performance of an AI:\n\n1. **Average Length:** Average length the snake has grown to (*max:* 64).\n2. **Average Steps:** Average steps the snake has moved.\n\nTest results (averaged over 1000 episodes):\n\n| Solver | Demo (optimal) | Average Length | Average Steps |\n| :----: | :------------: | :------------: | :-----------: |\n|[Hamilton][doc-hamilton]|![][demo-hamilton]|63.93|717.83|\n|[Greedy][doc-greedy]|![][demo-greedy]|60.15|904.56|\n|[DQN][doc-dqn]\u003cbr\u003e(experimental)|![][demo-dqn]|24.44|131.69|\n\n## Installation\n\nRequirements: Python 3.6+ with [Tkinter][doc-tkinter] installed.\n\n```\npip install -r requirements.txt\npython run.py [-h]\n```\n\nRun unit tests:\n\n```\npython -m pytest\n```\n\n## License\n\nSee the [LICENSE](./LICENSE) file for license rights and limitations.\n\n\n[snake-wiki]: https://en.wikipedia.org/wiki/Snake_(video_game)\n[snake-cpp]: https://github.com/chuyangliu/snake/tree/7227f5e0f3185b07e9e3de1ac5c19a17b9de3e3c\n\n[doc-tkinter]: https://docs.python.org/3/library/tkinter.html\n[doc-algorithms]: ./docs/algorithms.md\n[doc-greedy]: ./docs/algorithms.md#greedy-solver\n[doc-hamilton]: ./docs/algorithms.md#hamilton-solver\n[doc-dqn]: ./docs/algorithms.md#dqn-solver\n\n[demo-hamilton]: ./docs/images/solver_hamilton.gif\n[demo-greedy]: ./docs/images/solver_greedy.gif\n[demo-dqn]: ./docs/images/solver_dqn.gif\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchuyangliu%2Fsnake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchuyangliu%2Fsnake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchuyangliu%2Fsnake/lists"}