Skip to content

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.

Notifications You must be signed in to change notification settings

rkstudio585/rock-paper-scissors-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Certainly! Hereโ€™s a detailed README # Rock, Paper, Scissors Game ๐Ÿชจ๐Ÿ“„โœ‚๏ธ

In Python

Logo


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
  2. Features
  3. How to Run
  4. Gameplay Instructions
  5. 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:

    git clone https://github.com/mdriyadkhan585/rock-paper-scissors-C.git
  2. Navigate to the Project Directory:

    cd rock-paper-scissors-C
  3. Compile the Code: Use a C compiler like gcc:

    gcc -o rock_paper_scissors rock_paper_scissors.c
  4. Run the Program:

    ./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:

    int getComputerChoice() {
        return rand() % 3; // 0 = Rock, 1 = Paper, 2 = Scissors
    }
  2. Determining the Winner:

    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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages