Last active
November 22, 2019 07:46
-
-
Save roboter/1c67ec3083f3e5b38626b3a272e40fbd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lose = 0; | |
var win = 0; | |
var total = 0; | |
while (true) | |
{ | |
Console.WriteLine("Heads (0) or Tails (1)"); | |
var user = Console.ReadLine(); | |
var rand = new Random(); | |
var ht = rand.Next(0, 2); | |
if (user == "Heads" || user == "0" || user == "Tails" || user == "1") // 0 | |
{ | |
total = total + 1; | |
if ((user == "Heads" || user == "0") && ht == 0 || (user == "Tails" || user == "1") && ht == 1) | |
{ | |
Console.WriteLine("WIN"); | |
win = win + 1; | |
} | |
else | |
{ | |
Console.WriteLine("LOSE"); | |
lose = lose + 1; | |
} | |
} | |
else | |
if (user == "Exit") //exit | |
{ | |
Console.WriteLine("Goodbye"); | |
Console.WriteLine($"lose {lose}"); | |
Console.WriteLine("win {0}", win); | |
Console.WriteLine("total {0}", total); | |
break; | |
} | |
else | |
Console.WriteLine("LOSER"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment