-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMemoryCard.cs
More file actions
75 lines (69 loc) · 1.99 KB
/
MemoryCard.cs
File metadata and controls
75 lines (69 loc) · 1.99 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
69
70
71
72
73
74
75
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MemoryGame
{
/// <summary>Represents the letter sign displayed on a memory card (A through R).</summary>
public enum eCardSign
{
A = 'A',
B = 'B',
C = 'C',
D = 'D',
E = 'E',
F = 'F',
G = 'G',
H = 'H',
I = 'I',
J = 'J',
K = 'K',
L = 'L',
M = 'M',
N = 'N',
O = 'O',
P = 'P',
Q = 'Q',
R = 'R'
}
/// <summary>
/// Represents a single card in the Memory game. Each card has a sign and can be revealed or hidden.
/// </summary>
public struct MemoryCard
{
private readonly eCardSign r_CardSign;
private bool m_IsCardRevealed;
/// <summary>
/// Initializes a new card with the specified sign and visibility state.
/// </summary>
/// <param name="i_CardSign">The letter sign displayed when the card is revealed.</param>
/// <param name="i_IsCardRevealed">True if the card is face-up; false if face-down.</param>
public MemoryCard(eCardSign i_CardSign, bool i_IsCardRevealed)
{
r_CardSign = i_CardSign;
m_IsCardRevealed = i_IsCardRevealed;
}
/// <summary>Gets the letter sign displayed when the card is revealed.</summary>
public eCardSign CardSign
{
get
{
return r_CardSign;
}
}
/// <summary>Gets whether the card is currently face-up (revealed) or face-down (hidden).</summary>
public bool IsCardRevealed
{
get
{
return m_IsCardRevealed;
}
}
/// <summary>Toggles the card between revealed and hidden states.</summary>
public void FlipCard()
{
m_IsCardRevealed = !m_IsCardRevealed;
}
}
}