-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
55 lines (51 loc) · 1.66 KB
/
Program.cs
File metadata and controls
55 lines (51 loc) · 1.66 KB
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
using System.ComponentModel;
namespace GameAccount
{
class Program
{
static void Main(string[] args)
{
var me = new GameAccount("me","oponent");
var oponent = new GameAccount("oponent","me");
Game( me, oponent);
Console.WriteLine("\nTo show all games stats enter something\nTo skip press ENTER\n");
string i = Console.ReadLine();
if (i.Length > 0)
{
ShowStats(me.list);
}
}
public static void Game(GameAccount me, GameAccount oponent)
{
Random rnd = new Random();
me.num = rnd.Next();
oponent.num = rnd.Next();
if (me.num > oponent.num)
{
me.GameWin(me.CurrentRating, me.GameCount, me.OponentName);
}
else
{
me.GameLoose(me.CurrentRating, me.GameCount, me.OponentName);
}
me.list.Add(me.toString(me.UserName, me.OponentName, me.CurrentRating.ToString(), me.GameCount.ToString()));
string action = Console.ReadLine();
if (action.Length == 0)
{
Console.WriteLine("The end of the game \nYour score\nRating :"+me.CurrentRating +"\nGames played :"+me.GameCount);
}
else
{
Game(me, oponent);
}
}
public static void ShowStats(List<string> list)
{
Console.WriteLine("All games stats:\n");
foreach (string item in list)
{
Console.WriteLine(item+"\n");
}
}
}
}