private void btnBet_Click(object sender, EventArgs e) { Moves.Bet(ref pMoney, ref cMoney, ref pMoneyBet, ref cMoneyBet, 'p', Convert.ToInt32(numericBet.Value)); miniRound++; Card.UpdateNumeric(numericBet, cMoney, pMoney, bigStake, cMoneyBet, pMoneyBet); Card.UpdateMoney(lblComputerTotalMoneyValue, lblPTotalMoneyValue, lblCMoneyInBetValue, lbPlMoneyInbetValue, cMoney, pMoney, cMoneyBet, pMoneyBet); Moves.MakeComputerMove(ref pMoney, ref cMoney, ref pMoneyBet, ref cMoneyBet, numericBet, cards, pHand, cHand, table, picturesPHand, picturesTable, picturesCHand, lblComputerTotalMoneyValue, lblPTotalMoneyValue, lblCMoneyInBetValue, lbPlMoneyInbetValue, btnBet, btnCall, btnFold, btnCheck, continueToolStripMenuItem); }
private void btnCall_Click(object sender, EventArgs e) { Moves.Call(ref pMoney, ref cMoney, ref pMoneyBet, ref cMoneyBet, 'p'); if (table.Count == 5) { Card.DisableBtnsEnableContinue(btnBet, btnCall, btnFold, btnCheck, continueToolStripMenuItem); int[] computerRank = Card.RankHand(table, cHand); int[] playerRank = Card.RankHand(table, pHand); char winner = Card.DetermineWinner(playerRank, computerRank); Card.DistributeMoneyBasedOnWinner(ref pMoney, ref cMoney, ref pMoneyBet, ref cMoneyBet, winner); Card.UpdateAll ( numericBet, pHand, cHand, table, picturesPHand, picturesTable, picturesCHand, lblComputerTotalMoneyValue, lblPTotalMoneyValue, lblCMoneyInBetValue, lbPlMoneyInbetValue, cMoney, pMoney, cMoneyBet, pMoneyBet, bigStake ); } else { if (miniRound == 3 || !pStarts) { Card.DealAnotherCard(table, cards); Card.UpdateAll ( numericBet, pHand, cHand, table, picturesPHand, picturesTable, picturesCHand, lblComputerTotalMoneyValue, lblPTotalMoneyValue, lblCMoneyInBetValue, lbPlMoneyInbetValue, cMoney, pMoney, cMoneyBet, pMoneyBet, bigStake ); Card.SetComputerCardPicturesToRed(picturesCHand); miniRound = 1; btnCheck.Enabled = true; btnBet.Enabled = true; btnCall.Enabled = false; } else { miniRound++; Moves.MakeComputerMove(ref pMoney, ref cMoney, ref pMoneyBet, ref cMoneyBet, numericBet, cards, pHand, cHand, table, picturesPHand, picturesTable, picturesCHand, lblComputerTotalMoneyValue, lblPTotalMoneyValue, lblCMoneyInBetValue, lbPlMoneyInbetValue, btnBet, btnCall, btnFold, btnCheck, continueToolStripMenuItem); } } }
public void continueToolStripMenuItem_Click(object sender, EventArgs e) { if (cMoney <= 0) { MessageBox.Show("The computer has lost all of his money!", "Game over!"); } else if (pMoney <= 0) { MessageBox.Show("The player has lost all of his money!", "Game over!"); } else { miniRound = 1; pStarts = !pStarts; Card.ShuffleCards(cards); Card.DealInitial(cards, pHand, cHand, table); Card.BetStakes(ref pMoney, ref cMoney, ref pMoneyBet, ref cMoneyBet, bigStake); Card.UpdateAll ( numericBet, pHand, cHand, table, picturesPHand, picturesTable, picturesCHand, lblComputerTotalMoneyValue, lblPTotalMoneyValue, lblCMoneyInBetValue, lbPlMoneyInbetValue, cMoney, pMoney, cMoneyBet, pMoneyBet, bigStake ); Card.SetComputerCardPicturesToRed(picturesCHand); foreach (PictureBox box in picturesTable) { box.Visible = false; } btnBet.Enabled = true; btnCall.Enabled = true; btnFold.Enabled = true; btnCheck.Enabled = true; if (!pStarts) { Moves.MakeComputerMove(ref pMoney, ref cMoney, ref pMoneyBet, ref cMoneyBet, numericBet, cards, pHand, cHand, table, picturesPHand, picturesTable, picturesCHand, lblComputerTotalMoneyValue, lblPTotalMoneyValue, lblCMoneyInBetValue, lbPlMoneyInbetValue, btnBet, btnCall, btnFold, btnCheck, continueToolStripMenuItem); } } continueToolStripMenuItem.Enabled = false; }