Add project files.
This commit is contained in:
45
BlackJ/Player.cs
Normal file
45
BlackJ/Player.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BlackJack;
|
||||
|
||||
namespace BlackJack
|
||||
{
|
||||
public class Player
|
||||
{
|
||||
public double cash = 100;
|
||||
public List<Card> Hand = new List<Card>();
|
||||
public List<String[]> Inventory = new List<String[]>();
|
||||
|
||||
public void RemoveHand()
|
||||
{
|
||||
Hand = new List<Card>();
|
||||
}
|
||||
|
||||
public int GetHandValue()
|
||||
{
|
||||
int total = 0;
|
||||
int n = Hand.Count;
|
||||
for(int i = 0; i < n; i++)
|
||||
{
|
||||
Card card = Hand[i];
|
||||
|
||||
int cardValue = card.Number;
|
||||
total += cardValue;
|
||||
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
public Card DrawCard(Deck deck)
|
||||
{
|
||||
Card card = deck.Cards[0];
|
||||
Hand.Add(card);
|
||||
deck.Cards.Remove(card);
|
||||
|
||||
return card;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user