{"id":20438698,"url":"https://github.com/anurag1101/python_snake_water_gun","last_synced_at":"2025-03-05T07:23:16.088Z","repository":{"id":259582549,"uuid":"865469361","full_name":"Anurag1101/python_snake_water_gun","owner":"Anurag1101","description":"\"A simple Python game implementing the classic Snake, Water, Gun game (similar to Rock-Paper-Scissors) with user vs computer gameplay.\"","archived":false,"fork":false,"pushed_at":"2025-02-27T11:23:13.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-27T15:47:15.260Z","etag":null,"topics":["python","python-random","python-random-function","python3","snake-water-gun","snake-water-gun-game"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anurag1101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-09-30T15:25:07.000Z","updated_at":"2025-02-27T11:23:16.000Z","dependencies_parsed_at":"2024-10-26T18:10:48.201Z","dependency_job_id":"9d65c1f5-c63c-4c17-b1c2-5bab6f2b6acb","html_url":"https://github.com/Anurag1101/python_snake_water_gun","commit_stats":null,"previous_names":["anurag1101/python_snake_water_gun"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2Fpython_snake_water_gun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2Fpython_snake_water_gun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2Fpython_snake_water_gun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anurag1101%2Fpython_snake_water_gun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anurag1101","download_url":"https://codeload.github.com/Anurag1101/python_snake_water_gun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241983954,"owners_count":20052789,"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":["python","python-random","python-random-function","python3","snake-water-gun","snake-water-gun-game"],"created_at":"2024-11-15T09:12:59.731Z","updated_at":"2025-03-05T07:23:16.053Z","avatar_url":"https://github.com/Anurag1101.png","language":"Python","readme":"# Snake Water Gun Game\n\nThis is a Python implementation of the classic `Snake, Water, Gun` game, similar to Rock-Paper-Scissors. The game is played between the user and the computer.\n\n## Game Rules:\n- **Snake** beats **Water**\n- **Water** beats **Gun**\n- **Gun** beats **Snake**\n\nIf both the player and the computer choose the same, it results in a draw.\n\n## How to Play:\n1. The player chooses either `snake`, `water`, or `gun`.\n2. The computer randomly selects its choice.\n3. The program compares both choices and determines the winner based on the rules.\n\n## Code Overview:\nThe program uses Python's `random` module to make the computer's choice. The player's input is matched against predefined values for `snake`, `water`, or `gun`. After both choices are made, the game logic determines the winner or if it's a draw.\n\nHere’s a simplified breakdown:\n- **1 for Snake**, **-1 for Water**, and **0 for Gun**.\n- The game compares the player's choice and the computer's choice to decide the outcome.\n- If both choose the same, the game is a draw. Otherwise, the predefined logic determines the winner.\n\n**Code Breakdown:**\n\n**Choices:**\n\n    1 represents Snake.\n    -1 represents Water.\n    0 represents Gun.\n    \n**Game Logic:**\n\nThe player’s choice is converted into a corresponding numeric value using a dictionary (your_dict), and the computer’s choice is generated randomly.\n\nThe result is then computed by comparing the two choices:\n    If the player and the computer make the same choice, the game is a draw.\n    If the choices are different, a series of conditional statements determine the winner based on the game’s rules.\n\n## How to Run the Code:\n1. Clone the repository or download the code.\n2. Ensure you have Python 3.x installed on your system.\n3. Run the program from the terminal or command prompt:\n\n    ```bash\n    python snake_water_gun.py\n    ```\n\n4. Follow the instructions to enter your choice and see the result.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanurag1101%2Fpython_snake_water_gun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanurag1101%2Fpython_snake_water_gun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanurag1101%2Fpython_snake_water_gun/lists"}