Oct 6, 2016 at 1:18am UTC
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int PlayerChoice;
int compChoice;
void Intro();
{
cout <<" Welcome to Rock, Paper, Scissors, Lizard, Spock " << endl;
cout <<" Scissors cuts Paper covers Rock crushes Lizard poisons Spock smashes Scissors decapitates Lizard eats Paper disproves Spock vaporizes Rock crushes Scissors " << endl;
cout <<" " << endl;
cout <<" Please choose your choice: 1 = Rock, 2 = Paper " << endl;
cout <<" 3 = Scissors, 4 = Lizard, 5 = Spock " << endl;
cin >> PlayerChoice;
}
int CompChoice;
srand(time(0));
CompChoice = rand() % 5 + 1;
if ( CompChoice == 1 )
{
CompChoice = 1 ;
cout << " Computer Chooses: Rock " << endl;
}
else if ( CompChoice == 2 )
{
CompChoice = 2 ;
cout << " Computer Chooses: Paper " << endl;
}
else if ( CompChoice == 3 )
{
CompChoice = 3 ;
cout << " Computer Chooses: Scissors " << endl;
}
else if ( CompChoice == 4 )
{
CompChoice = 4 ;
cout << " Computer Chooses: Lizard " << endl;
}
else if ( CompChoice == 5 )
{
CompChoice = 5 ;
cout << " Computer Chooses: Spock " << endl;
return CompChoice;
}
if ( PlayerChoice == 1 )
{
cout <<" Player Chooses: Rock " << endl;
}
else if ( PlayerChoice == 2 )
{
cout <<" Player Chooses: Paper " << endl;
}
else if ( PlayerChoice == 3 )
{
cout <<" Player Chooses: Scissors " << endl;
}
else if ( PlayerChoice == 4 )
{
cout << " Player Chooses: Lizard " << endl;
}
else if ( PlayerChoice == 5 )
{
cout << " Player Chooses: Spock " << endl;
return PlayerChoice;
}
if ( ( PlayerChoice == 1 && CompChoice == 1 ) ||
( PlayerChoice == 2 && CompChoice == 2 ) ||
( PlayerChoice == 3 && CompChoice == 3 ) ||
( PlayerChoice == 4 && CompChoice == 4 ) ||
( PlayerChoice == 5 && CompChoice == 5 ) )
{
cout << " TIE! " << endl;
}
else if (( PlayerChoice == 3 && CompChoice == 2 ) ||
( PlayerChoice == 2 && CompChoice == 1 ) ||
( PlayerChoice == 1 && CompChoice == 4 ) ||
( PlayerChoice == 4 && CompChoice == 5 ) ||
( PlayerChoice == 5 && CompChoice == 3 ) ||
( PlayerChoice == 3 && CompChoice == 4 ) ||
( PlayerChoice == 4 && CompChoice == 2 ) ||
( PlayerChoice == 2 && CompChoice == 5 ) ||
( PlayerChoice == 5 && CompChoice == 1 ) ||
( PlayerChoice == 1 && CompChoice == 3 ))
{
cout << " You have WON! " << endl;
}
else if ( ( PlayerChoice == 2 && CompChoice == 3 ) ||
( PlayerChoice == 1 && CompChoice == 2 ) ||
( PlayerChoice == 4 && CompChoice == 1 ) ||
( PlayerChoice == 5 && CompChoice == 4 ) ||
( PlayerChoice == 3 && CompChoice == 5 ) ||
( PlayerChoice == 4 && CompChoice == 3 ) ||
( PlayerChoice == 2 && CompChoice == 4 ) ||
( PlayerChoice == 5 && CompChoice == 2 ) ||
( PlayerChoice == 1 && CompChoice == 5 ) ||
( PlayerChoice == 3 && CompChoice == 1 ) )
{
cout << " You have LOST! " << endl;
}
return 0;
}