-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.cs
More file actions
68 lines (62 loc) · 1.71 KB
/
Player.cs
File metadata and controls
68 lines (62 loc) · 1.71 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
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MemoryGame
{
/// <summary>Indicates whether a player is human or computer-controlled.</summary>
public enum eWhoPlay
{
Person,
Computer
}
/// <summary>
/// Represents a player in the Memory game. Holds the player's name, score, and type (human or computer).
/// </summary>
public struct Player
{
private readonly string r_Name;
private int m_Score;
private readonly eWhoPlay r_WhoPlay;
/// <summary>
/// Initializes a new player with the specified name and type.
/// </summary>
/// <param name="i_name">The player's display name.</param>
/// <param name="i_PlayerType">Whether the player is human or computer.</param>
public Player(string i_name, eWhoPlay i_PlayerType)
{
r_Name = i_name;
m_Score = 0;
r_WhoPlay = i_PlayerType;
}
/// <summary>Gets or sets the player's score (number of matched pairs).</summary>
public int Score
{
get
{
return m_Score;
}
set
{
m_Score = value;
}
}
/// <summary>Gets the player's display name.</summary>
public string Name
{
get
{
return r_Name;
}
}
/// <summary>Gets the player type as a string ("Person" or "Computer").</summary>
public string WhoPlay
{
get
{
return r_WhoPlay.ToString();
}
}
}
}