Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/rkstudio585/rock-paper-scissors-c
- Owner: rkstudio585
- Created: 2024-09-01T06:09:26.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-09-01T06:18:35.000Z (2 months ago)
- Last Synced: 2024-09-13T16:23:10.978Z (2 months ago)
- Topics: c, c-program, c-script, cprogramming, paper, program, programming, rk, rk-studio, rock, rock-paper-scissors-c, scissors
- Language: C
- Homepage: https://github.com/mdriyadkhan585
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 24. **Formatted Output:**
- Displays user and computer choices
- Announces the result in a clear and engaging format
---