public void initializeGame(int Hit) { PlayerHand = new List <Card>(); PlayerLabels = new List <Label>(); PcHand = new List <Card>(); PcLabels = new List <Label>(); if (Hit != 1) { //eliminare le carte estratte dal tavolo } Position = 0; PlayerScore = 0; PcScore = 0; Turn = 0; Bet = 0; Hit = 1; deck.shuffle(2 * numCards); //inizio partita lblPcTurn.Hide(); /*Hand(Turn); * Hand(Turn); * * Turn = 1; * Hand(Turn);*/ lblPcPoint.Text = PcScore.ToString(); lblPlayerPoints.Text = PlayerScore.ToString(); lblPlayerMoney.Text = PlayerMoney.ToString(); lblBetAmount.Text = Bet.ToString(); /*if (PlayerScore == 21) * { * System.Threading.Thread.Sleep(500); * Hand(Turn); * if (PcScore != 21) * { * MessageBox.Show("BLACKJACK! You win."); * PlayerMoney += (int)(Bet * winBlack); * } * else if (PcScore == 21) * { * MessageBox.Show("PUSH! Nothing done."); * PlayerMoney += Bet; * } * }*/ //Turn = 0; }
public void Hand() { if (Turn == 0) //carta giocatore { extractedCard = deck.extract(Position); PlayerScore += extractedCard.getPoints(); PlayerHand.Add(extractedCard); PlayerLabels.Add(createLabel(PlayerHand.Last(), PlayerLabels.Count)); this.Controls.Add(PlayerLabels.Last()); lblPlayerPoints.Text = PlayerScore.ToString(); controlPoints(); } else //carta pc { extractedCard = deck.extract(Position); PcScore += extractedCard.getPoints(); PcHand.Add(extractedCard); PcLabels.Add(createLabel(PcHand.Last(), PcLabels.Count)); this.Controls.Add(PcLabels.Last()); lblPcPoint.Text = PcScore.ToString(); controlPoints(); } }