{"id":18474298,"url":"https://github.com/scriptim/snake-battle","last_synced_at":"2025-05-13T01:40:12.961Z","repository":{"id":79134738,"uuid":"95149951","full_name":"Scriptim/Snake-Battle","owner":"Scriptim","description":"Play Snake with two players","archived":false,"fork":false,"pushed_at":"2018-07-12T22:45:40.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-16T19:32:35.583Z","etag":null,"topics":["game","game-2d","games","multiplayer","multiplayer-game","multiplayer-snake-game","pygame","python","python-2","python-2-7","python-game","raspberry","raspberry-pi","raspberry-pi-gpio","raspi","retro","snake","two-player"],"latest_commit_sha":null,"homepage":null,"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/Scriptim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-06-22T19:34:39.000Z","updated_at":"2023-03-02T04:25:45.000Z","dependencies_parsed_at":"2023-03-01T23:45:39.223Z","dependency_job_id":null,"html_url":"https://github.com/Scriptim/Snake-Battle","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/Scriptim%2FSnake-Battle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Scriptim%2FSnake-Battle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Scriptim%2FSnake-Battle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Scriptim%2FSnake-Battle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Scriptim","download_url":"https://codeload.github.com/Scriptim/Snake-Battle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856559,"owners_count":21974573,"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":["game","game-2d","games","multiplayer","multiplayer-game","multiplayer-snake-game","pygame","python","python-2","python-2-7","python-game","raspberry","raspberry-pi","raspberry-pi-gpio","raspi","retro","snake","two-player"],"created_at":"2024-11-06T10:28:59.237Z","updated_at":"2025-05-13T01:40:12.942Z","avatar_url":"https://github.com/Scriptim.png","language":"Python","readme":"# Snake Battle\n\nPlay **Snake** with two players\n\n**THIS GAME IS ALSO PLAYABLE ON A RASPBERRY PI USING GPIO INPUTS!**\n\n## Python and Requirements Installation\n\n### Windows\n\n- Download the latest Python 2 release from [here](https://www.python.org/downloads/windows/)\n- Run the installer (make sure to include *pip*)\n- Open `cmd.exe` as administrator and install the required packages by running `pip2 install \u003cpackage\u003e` or `python2 -m pip install \u003cpackage\u003e`\n\n### Linux\n\n- Install Python 2 using your package manager\n- Open a terminal and install the required packages by running `sudo pip2 install \u003cpackage\u003e`\n\n## Required Python Packages\n\n- [`pygame`](https://www.pygame.org)\n- [`RPi.GPIO`](https://pypi.python.org/pypi/RPi.GPIO) (only when used on a Raspberry Pi)\n\n## Setup Font\n\nBefore starting the game go to line *68* and *69* and change `None` to the path of a font file. If you don't specify a font Pygame will choose a default one.\n\nI recommend using [VT323 by Peter Hull](https://fonts.google.com/specimen/VT323 \"Google Fonts\")\n\n### Example\n\n    FONT_DB = pygame.font.Font(\"VT232.ttf\", 20) # debug font\n    FONT_SC = pygame.font.Font(\"VT232.ttf\", TILE_SIZE * 5) # score\n\n**Note: You should use an absolute path if you do not run the game from inside the directory**\n\n## Start Game\n\nOpen a terminal / cmd.exe and navigate to this folder then run\n\n    python2 snakebattle.py\n\nThe game is tested with **Python v2.7**, feel free to use any other compatible version\n\n## Play Game\n\n- Player 1:\n  - Turn left: `A`\n  - Turn right: `D`\n- Player 2:\n  - Turn left: `LEFT ARROW`\n  - Turn right: `RIGHT ARROW`\n- Collect food to grow\n- You will lose if you touch your opponent or the window borders\n- If both players \"lose\" at once the longer snake will win\n\n## Command Line Arguments\n\n`$ python2 snakebattle.py --help`\n\n    usage: snakebattle.py [-h] [-r] [-s PX] [-t X Y] [-d] [-f TPS] [-b MS]\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -r, --raspi           run snake battle on a raspberry pi\n      -s PX, --tilesize PX  the size of a tile\n      -t X Y, --tiles X Y   the number of tiles\n      -d, --debug           show debug information on the screen\n      -f TPS, --fps TPS     framerate in ticks per second\n      -b MS, --delay MS     button delay (raspi mode)\n\n## Raspberry Pi Mode (`--raspi`)\n\nConnect buttons to the following GPIO pins (BCM numbering)\n\n- Player 1 Left: **25**\n- Player 1 Right: **24**\n- Player 2 Left: **23**\n- Player 2 Right: **18**\n\nAlternatively, you can use other pins and change the pin numbers on lines *23 - 26*.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptim%2Fsnake-battle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptim%2Fsnake-battle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptim%2Fsnake-battle/lists"}