Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- /* * * * * * * * * * * * *
- * Rock, Paper, Scissors!*
- * *
- * BY: OPSFTW *
- * DATE: 1/23/2012 *
- * TIME: 4:08am *
- * * * * * * * * * * * * */
- namespace RockPaperScissors
- {
- class Program
- {
- static void Main()
- {
- string PlayStat = "Tied!";
- int Wins = 0;
- int Loss = 0;
- int Ties = 0;
- int Score = 0;
- int Comp = 0;
- Start:
- //First we declare the variables
- string UserMoveStr;
- int UserMoveInt;
- string CompMoveStr;
- int CompMoveInt;
- UserMoveInt = 0;
- Console.Write(":> Player's score: {0}", Score);
- Console.WriteLine("\t Computer's score: {0}", Comp);
- Console.Write(":> Wins: {0}", Wins);
- Console.Write("\t Loss: {0}", Loss);
- Console.WriteLine("\t Ties: {0}", Ties);
- Console.WriteLine(":> You are: {0}", PlayStat);
- Console.WriteLine(":> --------------------------");
- Console.WriteLine(":> Rock:1 Paper:2 Scissors:3");
- Console.Write(":>::");
- UserMoveStr = Console.ReadLine();
- if (UserMoveStr == "1")
- {
- UserMoveInt = 1;
- Console.WriteLine("You chose: Rock");
- }
- else if (UserMoveStr == "2")
- {
- UserMoveInt = 2;
- Console.WriteLine("You chose: Paper");
- }
- else if (UserMoveStr == "3")
- {
- UserMoveInt = 3;
- Console.WriteLine("You chose: Scissors");
- }
- else
- {
- Console.Clear();
- Console.WriteLine("\a ::ERROR::");
- goto Start;
- }
- Console.WriteLine(""); //To sepperate the Users move from the computers move
- //Now for he computer to make its move
- Random randomGenerator = new Random();
- CompMoveInt = randomGenerator.Next(1, 3);
- if (CompMoveInt == 1)
- {
- CompMoveStr = "Rock";
- Console.WriteLine("The computer chose: {0}", CompMoveStr);
- }
- else if (CompMoveInt == 2)
- {
- CompMoveStr = "Paper";
- Console.WriteLine("The computer chose: {0}", CompMoveStr);
- }
- else if (CompMoveInt == 2)
- {
- CompMoveStr = "Scissors";
- Console.WriteLine("The computer chose: {0}", CompMoveStr);
- }
- Console.WriteLine(""); //To sepperate for visual appeal
- Console.WriteLine("//////////////////////////////////"); //To sepperate the results from the moves
- Console.WriteLine(""); //To sepperate for visual appeal
- //Now to calculate the winner!
- if (UserMoveInt == 1)
- {
- if (CompMoveInt == 1)
- {
- Console.WriteLine("Tie!");
- UserMoveStr = Console.ReadLine();
- Ties = Ties + 1;
- }
- else if (CompMoveInt == 2)
- {
- Console.WriteLine("You Lose!");
- UserMoveStr = Console.ReadLine();
- Comp = Comp + 1;
- Loss = Loss + 1;
- }
- else if (CompMoveInt == 3)
- {
- Console.WriteLine("You Win!");
- UserMoveStr = Console.ReadLine();
- Score = Score + 1;
- Wins = Wins + 1;
- }
- }
- else if (UserMoveInt == 2)
- {
- if (CompMoveInt == 1)
- {
- Console.WriteLine("You Win!");
- UserMoveStr = Console.ReadLine();
- Score = Score + 1;
- Wins = Wins + 1;
- }
- else if (CompMoveInt == 2)
- {
- Console.WriteLine("Tie!");
- UserMoveStr = Console.ReadLine();
- Ties = Ties + 1;
- }
- else if (CompMoveInt == 3)
- {
- Console.WriteLine("You Lose!");
- UserMoveStr = Console.ReadLine();
- Comp = Comp + 1;
- Loss = Loss + 1;
- }
- }
- else if (UserMoveInt == 3)
- {
- if (CompMoveInt == 1)
- {
- Console.WriteLine("You Lose!");
- UserMoveStr = Console.ReadLine();
- Comp = Comp + 1;
- Loss = Loss + 1;
- }
- else if (CompMoveInt == 2)
- {
- Console.WriteLine("You Win!");
- UserMoveStr = Console.ReadLine();
- Score = Score + 1;
- Wins = Wins + 1;
- }
- else if (CompMoveInt == 3)
- {
- Console.WriteLine("Tie!");
- UserMoveStr = Console.ReadLine();
- Ties = Ties + 1;
- }
- }
- if (Comp > Score)
- {
- PlayStat = "Losing!";
- }
- if (Comp < Score)
- {
- PlayStat = "Winning!";
- }
- if (Comp == Score)
- {
- PlayStat = "Tied!";
- }
- Console.Clear();
- goto Start;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement