mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-25 20:34:32 -08:00
Removed spaces from top-level directory names.
Spaces tend to cause annoyances in a Unix-style shell environment. This change fixes that.
This commit is contained in:
48
74_Rock_Scissors_Paper/csharp/Program.cs
Normal file
48
74_Rock_Scissors_Paper/csharp/Program.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
|
||||
namespace RockScissorsPaper
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("GAME OF ROCK, SCISSORS, PAPER");
|
||||
Console.WriteLine("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine();
|
||||
Console.WriteLine();
|
||||
|
||||
var numberOfGames = GetNumberOfGames();
|
||||
|
||||
var game = new Game();
|
||||
for (var gameNumber = 1; gameNumber <= numberOfGames; gameNumber++) {
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Game number {0}", gameNumber);
|
||||
|
||||
game.PlayGame();
|
||||
}
|
||||
|
||||
game.WriteFinalScore();
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Thanks for playing!!");
|
||||
}
|
||||
|
||||
static int GetNumberOfGames()
|
||||
{
|
||||
while (true) {
|
||||
Console.WriteLine("How many games");
|
||||
if (int.TryParse(Console.ReadLine(), out var number))
|
||||
{
|
||||
if (number < 11 && number > 0)
|
||||
return number;
|
||||
Console.WriteLine("Sorry, but we aren't allowed to play that many.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Sorry, I didn't understand.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user