-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
87 lines (76 loc) · 3.28 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.IO;
namespace PokerConsoleApp
{
public static class Program
{
public static int PlayerCount { get; private set; }
static void Main()
{
Console.WriteLine($"Current Directory: \n\t\t{Directory.GetCurrentDirectory().ToString()}");
Console.ReadLine();
DisplayMenu();
}
static Program()
{
PlayerCount = 4;
}
public static void DisplayMenu()
{
bool _exitFlag = false;
do
{
Console.Clear();
PrintMenuText();
string sInput = Console.ReadLine();
if (Int32.TryParse(sInput, out int userChoice))
{
switch (userChoice)
{
case 1:
int _numGames = UtilityMethods.GetIntegerFromUser(3000, 2000000000);
var watch = new System.Diagnostics.Stopwatch();
watch.Start();
Simulation.SimulateGames(PlayerCount, _numGames);
watch.Stop();
Console.WriteLine($"Total Execution Time: {(watch.ElapsedMilliseconds / 60000.0).ToString("0.##")} minutes");
UtilityMethods.GetKeyPress();
break;
case 2:
Game.PlayGame();
UtilityMethods.GetKeyPress();
break;
case 3:
Console.WriteLine("Enter number of players (2 to 8):");
// update value of Program.PlayerCount for use by other methods
PlayerCount = UtilityMethods.GetIntegerFromUser(2, 8);
UtilityMethods.GetKeyPress();
break;
case 4:
SqliteMethods.ShowDatabaseStatistics();
UtilityMethods.GetKeyPress();
break;
case 5:
_exitFlag = true;
break;
default:
break;
}
}
} while (_exitFlag == false);
}
private static void PrintMenuText()
{
Console.WriteLine("-------------------------------------------------------------------------");
Console.WriteLine(" MAIN MENU ");
Console.WriteLine("-------------------------------------------------------------------------");
Console.WriteLine("1 - Simulate games to build up database");
Console.WriteLine("2 - Enter poker training mode");
Console.WriteLine($"3 - Change number of players (currently set to {PlayerCount})");
Console.WriteLine("4 - View database statistics");
Console.WriteLine("5 - Exit");
Console.WriteLine("-------------------------------------------------------------------------");
Console.WriteLine("Please make a selection:");
}
}
}