GithubHelp home page GithubHelp logo

shreyaschavhan / rock-paper-scissors-game Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 9.0 237 KB

Rock paper scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper", and "scissors". This C++ Program [Mini Project] is aimed at automating one of the player called as Computerized Player and the taking rock, paper or scissor as an input from the used.

License: MIT License

C++ 100.00%
rock-paper-scissors rock-crushes-scissors scissors scissors-cuts-paper rock game cpp mini-project

rock-paper-scissors-game's Introduction

Rock Paper Scissors


Description : Rock paper scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper", and "scissors". This C++ Program [Mini Project] is aimed at automating one of the player called as Computerized Player and the taking rock, paper or scissor as an input from the used.


Introduction

Rock paper scissors (also known by other orderings of the three items, with "rock" sometimes being called "stone", roshambo or ro-sham-bo) is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock" (a closed fist), "paper" (a flat hand), and "scissors" (a fist with the index finger and middle finger extended, forming a V). "Scissors" is identical to the two-fingered V sign (also indicating "victory" or "peace") except that it is pointed horizontally instead of being held upright in the air.

A simultaneous, zero-sum game, it has only two possible outcomes: a draw, or a win for one player and a loss for the other. A player who decides to play rock will beat another player who has chosen scissors ("rock crushes scissors" or sometimes "blunts scissors"), but will lose to one who has played paper ("paper covers rock"); a play of paper will lose to a play of scissors ("scissors cuts paper"). If both players choose the same shape, the game is tied and is usually immediately replayed to break the tie. Read More on Wiki Pedia

Game Play

The players may count aloud to three, or speak the name of the game (e.g. "Rock! Paper! Scissors!"), either raising one hand in a fist and swinging it down with each syllable or holding it behind their back. They then "throw" by extending it towards their opponent. Variations include a version where players throw immediately on the third count (thus throwing on the count of "Scissors!"), or a version where they shake their hands three times before "throwing". We are going to computerize this game play, so that computer will choose some random choice while the player will have the choice to choose one [Rock! Paper! or Scissors! ]

Rules

A player who decides to play rock will beat another player who has chosen scissors ("rock crushes scissors" or sometimes "blunts scissors"), but will lose to one who has played paper ("paper covers rock"); a play of paper will lose to a play of scissors ("scissors cuts paper"). If both players choose the same shape, the game is tied and is usually immediately replayed to break the tie.

Image Credits : Wiki Pedia

Possible cases -

  • if (player == rock) and (computer == paper); computer wins

  • if (player == paper) and (computer == paper); tie

  • if (player == scissors) and (computer == paper); player wins

  • if (player == rock) and (computer == rock); tie

  • if (player == paper) and (computer == rock); player wins

  • if (player == scissors) and (computer == rock); computer wins

  • if (player == rock) and (computer == scissors); player wins

  • if (player == paper) and (computer == scissors); computer wins

  • if (player == scissors) and (computer == scissors); tie

Algorithm

  1. The computer will choose a random choice between "Rock", "Paper" and "Scissor". Logic - = We will generate a random number between 1 - 100; if the number is in between = less than 33 --> Computer will choose Rock = 33 - 66 --> Computer will choose Paper = greater than 66 --> Computer will choose Scissor

  2. User Input will be taken.

  3. Input will be compared with computers choice.

  4. According to rules, one of them will win.

Dependencies

  • C++ Language

Requirements

  • 64 Bit Windows / Open Source Linux & its derivatives.
  • Open Source Programming Tools like G++/GCC, C++ IDE (Visual Studio Code or any other).

Output

A Project by Shreyas Chavhan

rock-paper-scissors-game's People

Contributors

shreyaschavhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rock-paper-scissors-game's Issues

clang: error: linker command failed with exit code 1 (use -v to see invocation)

rock-paper-scissor.cpp:29:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
}
^
1 warning generated.
"/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch arm64 -platform_version macos 14.0.0 14.4 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -o a.out -L/usr/local/lib /var/folders/9m/013mfxhx7px4pnzc5370k64r0000gn/T/rock-paper-scissor-55f91b.o -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/15.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture arm64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::ctype const& std::__1::use_facet[abi:ue170006]<std::__1::ctype>(std::__1::locale const&) in rock-paper-scissor-55f91b.o
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ios<char, std::__1::char_traits>::widenabi:ue170006 const in rock-paper-scissor-55f91b.o
"std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>::__init(unsigned long, char)", referenced from:
std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>::basic_string[abi:ue170006](unsigned long, char) in rock-paper-scissor-55f91b.o
"std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>::~basic_string()", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits> std::__1::__pad_and_output[abi:ue170006]<char, std::__1::char_traits>(std::__1::ostreambuf_iterator<char, std::__1::char_traits>, char const*, char const*, char const*, std::__1::ios_base&, char) in rock-paper-scissor-55f91b.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits> std::__1::__pad_and_output[abi:ue170006]<char, std::__1::char_traits>(std::__1::ostreambuf_iterator<char, std::__1::char_traits>, char const*, char const*, char const*, std::__1::ios_base&, char) in rock-paper-scissor-55f91b.o
"std::__1::basic_istream<char, std::__1::char_traits>::sentry::sentry(std::__1::basic_istream<char, std::__1::char_traits>&, bool)", referenced from:
std::__1::basic_istream<char, std::__1::char_traits>& std::__1::operator>>[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_istream<char, std::__1::char_traits>&, char&) in rock-paper-scissor-55f91b.o
"std::__1::basic_ostream<char, std::__1::char_traits>::put(char)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::endl[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&) in rock-paper-scissor-55f91b.o
"std::__1::basic_ostream<char, std::__1::char_traits>::flush()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::endl[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&) in rock-paper-scissor-55f91b.o
"std::__1::basic_ostream<char, std::__1::char_traits>::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits>&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::__put_character_sequence[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&, char const*, unsigned long) in rock-paper-scissor-55f91b.o
"std::__1::basic_ostream<char, std::__1::char_traits>::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::__put_character_sequence[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&, char const*, unsigned long) in rock-paper-scissor-55f91b.o
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::__put_character_sequence[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&, char const*, unsigned long) in rock-paper-scissor-55f91b.o
"std::__1::cin", referenced from:
_main in rock-paper-scissor-55f91b.o
_main in rock-paper-scissor-55f91b.o
"std::__1::cout", referenced from:
_main in rock-paper-scissor-55f91b.o
"std::__1::ctype::id", referenced from:
std::__1::ctype const& std::__1::use_facet[abi:ue170006]<std::__1::ctype>(std::__1::locale const&) in rock-paper-scissor-55f91b.o
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ios<char, std::__1::char_traits>::widenabi:ue170006 const in rock-paper-scissor-55f91b.o
std::__1::basic_ios<char, std::__1::char_traits>::widenabi:ue170006 const in rock-paper-scissor-55f91b.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::__put_character_sequence[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&, char const*, unsigned long) in rock-paper-scissor-55f91b.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::ios_base::setstate[abi:ue170006](unsigned int) in rock-paper-scissor-55f91b.o
"std::terminate()", referenced from:
___clang_call_terminate in rock-paper-scissor-55f91b.o
"___cxa_begin_catch", referenced from:
std::__1::basic_istream<char, std::__1::char_traits>& std::__1::operator>>[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_istream<char, std::__1::char_traits>&, char&) in rock-paper-scissor-55f91b.o
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::__put_character_sequence[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&, char const*, unsigned long) in rock-paper-scissor-55f91b.o
___clang_call_terminate in rock-paper-scissor-55f91b.o
"___cxa_call_unexpected", referenced from:
std::__1::char_traits::length[abi:ue170006](char const*) in rock-paper-scissor-55f91b.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits>::ostreambuf_iterator[abi:ue170006](std::__1::basic_ostream<char, std::__1::char_traits>&) in rock-paper-scissor-55f91b.o
"___cxa_end_catch", referenced from:
std::__1::basic_istream<char, std::__1::char_traits>& std::__1::operator>>[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_istream<char, std::__1::char_traits>&, char&) in rock-paper-scissor-55f91b.o
std::__1::basic_istream<char, std::__1::char_traits>& std::__1::operator>>[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_istream<char, std::__1::char_traits>&, char&) in rock-paper-scissor-55f91b.o
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::__put_character_sequence[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&, char const*, unsigned long) in rock-paper-scissor-55f91b.o
std::__1::basic_ostream<char, std::__1::char_traits>& std::__1::__put_character_sequence[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_ostream<char, std::__1::char_traits>&, char const*, unsigned long) in rock-paper-scissor-55f91b.o
"___cxa_rethrow", referenced from:
std::__1::basic_istream<char, std::__1::char_traits>& std::__1::operator>>[abi:ue170006]<char, std::__1::char_traits>(std::__1::basic_istream<char, std::__1::char_traits>&, char&) in rock-paper-scissor-55f91b.o
"___gxx_personality_v0", referenced from:
/private/var/folders/9m/013mfxhx7px4pnzc5370k64r0000gn/T/rock-paper-scissor-55f91b.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.