-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.cs
94 lines (79 loc) · 1.91 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
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
88
89
90
91
92
93
94
using System;
using System.Drawing;
namespace etf.backgammon.bi140643d
{
public class Player
{
private String name;
private Color color;
private int direction; // +1, -1
private int points = 0;
private int gamePoints = 0;
private bool penalty = false;
private bool computer;
private Player opponent;
public bool IsCPU
{
get { return computer; }
}
public static void MakeOpponents(Player p1, Player p2)
{
p1.opponent = p2;
p2.opponent = p1;
}
public Player Opponent
{
get { return opponent; }
}
public bool Penalty
{
get { return penalty; }
set { penalty = value; }
}
public int GamePoints
{
get { return gamePoints; }
set { gamePoints = value; }
}
public void ResetPoints()
{
points = 147;
}
public int GetPoints()
{
return points;
}
public String Name
{
get { return name; }
}
public int Direction
{
get { return direction; }
}
public Color TokenColor
{
get { return color; }
}
public void AddPoints(int Points)
{
this.points += Points;
}
public void SubPoints(int Points)
{
if (this.points >= Points)
this.points -= Points;
}
public Player(String name, Color color, int direction, bool computer)
{
this.name = name;
this.color = color;
this.direction = direction;
this.computer = computer;
}
public override String ToString()
{
return name;
}
}
}