public void Deal(List <Card> deck, Participents participant) { Card card = deck[0]; participant.cardList.Add(card); deck.RemoveAt(0); }
public void IsWinner(Participents player) { // player won the game if (player.Name == "player1") { cardCountPlayer1.Invoke(new Action(delegate() { cardCountPlayer1.Text = String.Format("Cardcount: {0}", engine.GetCardCount("player1").ToString()); })); resultLabel.Invoke(new Action(delegate() { resultLabel.Text = "PLAYER 1 WON THE GAME!"; })); } else if (player.Name == "player2") { cardCountPlayer2.Invoke(new Action(delegate() { cardCountPlayer2.Text = String.Format("Cardcount: {0}", engine.GetCardCount("player2").ToString()); })); resultLabel.Invoke(new Action(delegate() { resultLabel.Text = "PLAYER 2 WON THE GAME!"; })); } else { // dealer won cardCountDealer.Invoke(new Action(delegate() { cardCountDealer.Text = String.Format("Cardcount: {0}", engine.GetCardCount("dealer").ToString()); })); resultLabel.Invoke(new Action(delegate() { resultLabel.Text = "DEALER WON THE GAME!"; })); } DrawEndGame(); }
public void BustPlayer(Participents player) { // player is dead so exclude from game if (player.Name == "player1") { cardCountPlayer1.Invoke(new Action(delegate() { cardCountPlayer1.Text = "BUSTED!"; })); DrawPlayer2Turn(); } else if (player.Name == "player2") { cardCountPlayer2.Invoke(new Action(delegate() { cardCountPlayer2.Text = "BUSTED!"; })); hitButtonPlayer2.Invoke(new Action(delegate() { hitButtonPlayer2.Enabled = false; })); standButtonPlayer2.Invoke(new Action(delegate() { standButtonPlayer2.Enabled = false; })); // Change Game State Engine.State = Enums.GameStates.EndGame; } else { // dealer busted cardCountDealer.Invoke(new Action(delegate() { cardCountDealer.Text = "BUSTED!"; })); } }