-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHand.cs
More file actions
62 lines (51 loc) · 1.43 KB
/
Hand.cs
File metadata and controls
62 lines (51 loc) · 1.43 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BlackjackSandbox
{
/// <summary>
/// Represents a hand of cards
/// </summary>
public class Hand
{
/// <summary>
/// Who owns this hand?
/// </summary>
public Entity Owner { get; private set; }
/// <summary>
/// The cards in this hand
/// </summary>
public List<Card> Cards { get; private set; }
/// <summary>
/// What bet has been placed on this hand
/// </summary>
public int Bet { get; set; }
/// <summary>
/// Is this hand the result of a split?
/// </summary>
public bool IsSplit { get; set; }
public Hand(Entity owner, Card a, Card b, int bet)
{
Owner = owner;
Cards = new List<Card>();
Cards.Add(a);
Cards.Add(b);
Bet = bet;
}
/// <summary>
/// Gets the string representation of this hand (cards, followed by the hand value)
/// </summary>
/// <returns></returns>
public string ToShortString()
{
string ret = "";
foreach (Card c in Cards)
{
ret += c.ToShortString() + " ";
}
ret += string.Format("[{0}]", HandHelper.GetHandValue(Cards.AsReadOnly()));
return ret;
}
}
}