Add files via upload
This commit is contained in:
5 files changed
+181
No files matched your search
@@ -0,0 +1,18 @@
|
|||||||
|
class Menu
|
||||||
|
{
|
||||||
|
public Menu()
|
||||||
|
{
|
||||||
|
OnePlayer menu1 = new OnePlayer();
|
||||||
|
TwoPlayer menu2 = new TwoPlayer();
|
||||||
|
Console.Write("ROCK, PAPER, SCISSORS\nChoose Game Mode:\tSingle Player (1), 2-Player (2)");
|
||||||
|
Console.Write("\nType and Enter: ");
|
||||||
|
int a = int.Parse(Console.ReadLine());
|
||||||
|
if(a == 1){
|
||||||
|
menu1.Play();
|
||||||
|
}else if(a == 2){
|
||||||
|
menu2.Play();
|
||||||
|
}else{
|
||||||
|
Console.Write("Invalid input!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
class OnePlayer
|
||||||
|
{
|
||||||
|
public void Play()
|
||||||
|
{
|
||||||
|
Random random = new Random();
|
||||||
|
bool userRestart = true;
|
||||||
|
int playerChoose = 0;
|
||||||
|
int playerWinStreak = 0;
|
||||||
|
|
||||||
|
do{
|
||||||
|
Console.Clear();
|
||||||
|
Console.Write("Type and Enter (1/2/3/4) 1 = Rock, 2 = Paper, 3 = Scissors, 4 = exit");
|
||||||
|
Console.Write($"\nWin Streak: {playerWinStreak} \t\tInput: ");
|
||||||
|
playerChoose = int.Parse(Console.ReadLine());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int randomNum = random.Next(1, 4);
|
||||||
|
if(playerChoose == 1 && randomNum == 1){
|
||||||
|
Console.Write("You picked Rock, Cpu picked Rock");
|
||||||
|
Console.Write("\nTIE!");
|
||||||
|
}else if(playerChoose == 1 && randomNum == 2){
|
||||||
|
Console.Write("You picked Rock, Cpu picked Paper");
|
||||||
|
Console.Write("\nYOU LOSE!");
|
||||||
|
playerWinStreak = 0;
|
||||||
|
}else if(playerChoose == 1 && randomNum == 3){
|
||||||
|
Console.Write("You picked Rock, Cpu picked Scissors");
|
||||||
|
Console.Write("\nYOU WIN!");
|
||||||
|
playerWinStreak++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(playerChoose == 2 && randomNum == 1){
|
||||||
|
Console.Write("You picked Paper, Cpu picked Rock");
|
||||||
|
Console.Write("\nYOU WIN!");
|
||||||
|
playerWinStreak++;
|
||||||
|
}else if(playerChoose == 2 && randomNum == 2){
|
||||||
|
Console.Write("You picked Paper, Cpu picked Paper");
|
||||||
|
Console.Write("\nTIE!");
|
||||||
|
}else if(playerChoose == 2 && randomNum == 3){
|
||||||
|
Console.Write("You picked Paper, Cpu picked Scissors");
|
||||||
|
Console.Write("\nYOU LOSE!");
|
||||||
|
playerWinStreak = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(playerChoose == 3 && randomNum == 1){
|
||||||
|
Console.Write("You picked Scissors, Cpu picked Rock");
|
||||||
|
Console.Write("\nYOU LOSE!");
|
||||||
|
|
||||||
|
}else if(playerChoose == 3 && randomNum == 2){
|
||||||
|
Console.Write("You picked Scissors, Cpu picked Paper");
|
||||||
|
Console.Write("\nYOU WIN!");
|
||||||
|
playerWinStreak++;
|
||||||
|
}else if(playerChoose == 3 && randomNum == 3){
|
||||||
|
Console.Write("You picked Scissors, Cpu picked Scissors");
|
||||||
|
Console.Write("\nTIE!");
|
||||||
|
playerWinStreak = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(playerChoose == 4){
|
||||||
|
Console.Write("Game Exit...");
|
||||||
|
userRestart = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(1500);
|
||||||
|
|
||||||
|
}while(userRestart);
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Menu menu0 = new Menu();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
class TwoPlayer
|
||||||
|
{
|
||||||
|
public void Play()
|
||||||
|
{
|
||||||
|
Random ahhhh = new Random();
|
||||||
|
bool restart = true;
|
||||||
|
int playerOnePick = 0;
|
||||||
|
int playerTwoPick = 0;
|
||||||
|
while(restart){
|
||||||
|
int random = ahhhh.Next(1, 2);
|
||||||
|
Console.Clear();
|
||||||
|
if(random == 1){
|
||||||
|
Console.Write("Player One First");
|
||||||
|
Console.Write("\nType and Enter (1/2/3/4) 1 = Rock, 2 = Paper, 3 = Scissors, 4 = exit");
|
||||||
|
Console.Write("\nPlayer One: ");
|
||||||
|
playerOnePick = int.Parse(Console.ReadLine());
|
||||||
|
Console.Clear();
|
||||||
|
Console.Write("\nType and Enter (1/2/3/4) 1 = Rock, 2 = Paper, 3 = Scissors, 4 = exit");
|
||||||
|
Console.Write("\nPlayer Two: ");
|
||||||
|
playerTwoPick = int.Parse(Console.ReadLine());
|
||||||
|
Console.Clear();
|
||||||
|
|
||||||
|
}else if(random == 2){
|
||||||
|
Console.Write("Player Two First");
|
||||||
|
Console.Write("\nType and Enter (1/2/3/4) 1 = Rock, 2 = Paper, 3 = Scissors, 4 = exit");
|
||||||
|
Console.Write("\nPlayer Two: ");
|
||||||
|
playerTwoPick = int.Parse(Console.ReadLine());
|
||||||
|
Console.Clear();
|
||||||
|
Console.Write("\nType and Enter (1/2/3/4) 1 = Rock, 2 = Paper, 3 = Scissors, 4 = exit");
|
||||||
|
Console.Write("\nPlayer One: ");
|
||||||
|
playerOnePick = int.Parse(Console.ReadLine());
|
||||||
|
Console.Clear();
|
||||||
|
}
|
||||||
|
if(playerOnePick == 4 || playerTwoPick == 4){
|
||||||
|
Console.Write("Game Exit...");
|
||||||
|
restart = false;
|
||||||
|
}
|
||||||
|
Algo(playerOnePick, playerTwoPick);
|
||||||
|
Thread.Sleep(2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Algo(int a, int b )
|
||||||
|
{
|
||||||
|
if(a == 1 && b == 1){
|
||||||
|
Console.Write("Player One Picked: Rock\nPlayer Two Picked: Rock");
|
||||||
|
Console.Write("\nNO WIN, TIE!");
|
||||||
|
}else if (a == 1 && b == 2){
|
||||||
|
Console.Write("Player One Picked: Rock\nPlayer Two Picked: Paper");
|
||||||
|
Console.Write("\nPLAYER TWO WIN!");
|
||||||
|
}else if(a == 2 && b == 1){
|
||||||
|
Console.Write("Player One Picked: Paper\nPlayer Two Picked: Rock");
|
||||||
|
Console.Write("\nPLAYER ONE WIN!");
|
||||||
|
}else if(a == 1 && b == 3){
|
||||||
|
Console.Write("Player One Picked: Rock\nPlayer Two Picked: Scissors");
|
||||||
|
Console.Write("\nPLAYER ONE WIN!");
|
||||||
|
}else if (a == 3 && b == 1){
|
||||||
|
Console.Write("Player One Picked: Scissors\nPlayer Two Picked: Rock");
|
||||||
|
Console.Write("\nPLAYER TWO WIN!");
|
||||||
|
}else if(a == 2 && b == 2){
|
||||||
|
Console.Write("Player One Picked: Paper\nPlayer Two Picked: Paper");
|
||||||
|
Console.Write("\nNO WIN, TIE!");
|
||||||
|
}else if(a == 2 && b == 3){
|
||||||
|
Console.Write("Player One Picked: Paper\nPlayer Two Picked: Scissors");
|
||||||
|
Console.Write("\nPLAYER TWO WIN!");
|
||||||
|
}else if(a == 3 && b == 2){
|
||||||
|
Console.Write("Player One Picked: Scissors\nPlayer Two Picked: Paper");
|
||||||
|
Console.Write("\nPLAYER ONE WIN!");
|
||||||
|
}else if(a == 3 && b == 3){
|
||||||
|
Console.Write("Player One Picked: Scissors\nPlayer Two Picked: Scissors");
|
||||||
|
Console.Write("\nNO WIN, TIE!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user