-
Notifications
You must be signed in to change notification settings - Fork 1
/
Player.cs
35 lines (32 loc) · 1.08 KB
/
Player.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
namespace TicaTacToe
{
internal class Player
{
public string Symbol { get; private set; }
public string WiningMessage { get; private set; } //shows at new window on win
public int WinCounter { get; private set; }
public int ArrayValue { get; private set; } //value placed in array for checking wind condition, 1 for P1(win condition sum of 3 in row/column) and -1 for P2(win condition sum of -3 in row/column)
public byte[] PlayerColor { get; private set; } //used for setting foreground color every time changing between 'X' and 'O'
public Player(string symbol,byte[] color, int arrayValue)
{
Symbol = symbol;
WiningMessage = $"{symbol} has won!";
PlayerColor = color;
ArrayValue = arrayValue;
WinCounter = 0;
}
public string HasWon()
{
return WiningMessage;
}
public void WinIncrement()
{
WinCounter++;
}
public void WinReset()
{
WinCounter=0;
}
}
}