Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rkstudio585/rock-paper-scissors-c

A simple Rock, Paper, Scissors game implemented in C. Play against the computer by choosing Rock, Paper, or Scissors. The game displays choices and announces the winner, providing a clear and interactive experience. Easy to compile and run on any system with a C compiler.
https://github.com/rkstudio585/rock-paper-scissors-c

c c-program c-script cprogramming paper program programming rk rk-studio rock rock-paper-scissors-c scissors

Last synced: 7 days ago
JSON representation

A simple Rock, Paper, Scissors game implemented in C. Play against the computer by choosing Rock, Paper, or Scissors. The game displays choices and announces the winner, providing a clear and interactive experience. Easy to compile and run on any system with a C compiler.

Awesome Lists containing this project

README

        

Certainly! Hereโ€™s a detailed README # Rock, Paper, Scissors Game ๐Ÿชจ๐Ÿ“„โœ‚๏ธ
---
[In Python](https://github.com/mdriyadkhan585/rock-paper-scissors-python)

![Logo](logo.svg)

---
Welcome to the Rock, Paper, Scissors game! This is a simple command-line game where you play against the computer. Choose Rock, Paper, or Scissors, and see who wins!

## Table of Contents ๐Ÿ“š

1. [Introduction](#introduction)
2. [Features](#features)
3. [How to Run](#how-to-run)
4. [Gameplay Instructions](#gameplay-instructions)
5. [Code Explanation](#code-explanation)

## Introduction

This project is a basic implementation of the Rock, Paper, Scissors game in C. It demonstrates fundamental concepts such as user input, random number generation, and simple decision-making.

## Features ๐ŸŒŸ

- Play Rock, Paper, Scissors against the computer ๐Ÿค–
- Clear and informative output ๐Ÿ’ฌ
- Randomized computer choices ๐ŸŽฒ
- Simple and easy-to-understand code ๐Ÿงฉ

## How to Run ๐Ÿš€

1. **Clone the Repository:**
```bash
git clone https://github.com/mdriyadkhan585/rock-paper-scissors-C.git
```

2. **Navigate to the Project Directory:**
```bash
cd rock-paper-scissors-C
```

3. **Compile the Code:**
Use a C compiler like `gcc`:
```bash
gcc -o rock_paper_scissors rock_paper_scissors.c
```

4. **Run the Program:**
```bash
./rock_paper_scissors
```

## Gameplay Instructions ๐ŸŽฎ

1. **Start the Game:**
After running the program, youโ€™ll be prompted to enter your choice.

2. **Enter Your Choice:**
- Type `0` for Rock ๐Ÿชจ
- Type `1` for Paper ๐Ÿ“„
- Type `2` for Scissors โœ‚๏ธ

3. **View the Results:**
The program will display the computer's choice and the result of the game (win, lose, or tie).

4. **Play Again:**
You can run the program again to play another round.

## Code Explanation ๐Ÿ› ๏ธ

1. **Getting the Computer's Choice:**
```c
int getComputerChoice() {
return rand() % 3; // 0 = Rock, 1 = Paper, 2 = Scissors
}
```

2. **Determining the Winner:**
```c
void determineWinner(int playerChoice, int computerChoice) {
// Compares choices and prints the result
}
```

3. **User Input and Validation:**
- Prompts the user to enter their choice
- Validates the input to ensure it's between 0 and 2

4. **Formatted Output:**
- Displays user and computer choices
- Announces the result in a clear and engaging format
---