Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vishwas567917/snake-water-gun-game
Snake, Water, Gun is a console-based game developed in C. It simulates the classic hand game with simple text-based interactions. Ideal for learning basic game logic, conditional statements, and user input handling in C.
https://github.com/vishwas567917/snake-water-gun-game
c-programming-language game
Last synced: about 10 hours ago
JSON representation
Snake, Water, Gun is a console-based game developed in C. It simulates the classic hand game with simple text-based interactions. Ideal for learning basic game logic, conditional statements, and user input handling in C.
- Host: GitHub
- URL: https://github.com/vishwas567917/snake-water-gun-game
- Owner: Vishwas567917
- Created: 2024-08-25T04:13:31.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-08-25T04:20:26.000Z (about 1 month ago)
- Last Synced: 2024-09-24T21:17:27.323Z (about 15 hours ago)
- Topics: c-programming-language, game
- Language: C
- Homepage:
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Snake-Water-Gun Game
This project is a simple console-based Snake-Water-Gun game implemented in C. It simulates a game between a user and the computer, where each player can choose between "snake", "water", or "gun". The game then decides the winner based on standard rules.
## Game Rules
- **Snake vs Water**: Snake drinks the water, Snake wins.
- **Water vs Gun**: Gun sinks in water, Water wins.
- **Gun vs Snake**: Gun shoots the snake, Gun wins.
- **Same choices**: It's a draw.## How the Game Works
1. The computer randomly selects one of the three options: Snake (`s`), Water (`w`), or Gun (`g`).
2. The user inputs their choice.
3. The program then compares the user's choice with the computer's choice to determine the outcome (win, lose, or draw).## Technologies Used
- **C**: The programming language used to implement the game logic.
## Installation
1. Clone the repository:
```bash
git clone https://github.com/your-username/snake-water-gun-game.git
2. Navigate to the project directory:
```bash
cd snake-water-gun-game
3. Compile the code using a C compiler:
```bash
gcc -o snake_water_gun snake_water_gun.c
4. Run the executable:
```bash
./snake_water_gunUsage
1. Run the program.
2. You will be prompted to choose s for Snake, w for Water, or g for Gun.
3. The program will display your choice, the computer's choice, and the result of the game.File Structure
# snake_water_gun.c: Main C file containing the Snake-Water-Gun game implementation.# Example Output
```bash
Enter s for snake, w for water, g for gun
s
You chose s and computer chose w : You win!