Exemple #1
0
        private void btnActions_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender == btnCheck)
                {
                    objPokerGame.Check(objPlayerYou);
                    WaitUntilComBet();
                }
                else if (sender == btnBet)
                {
                    float sngAmt = Convert.ToInt32(Interaction.InputBox("Enter amount you want to bet:", "Type the amount", "", -1, -1));

                    objPokerGame.Bet(objPlayerYou, sngAmt);
                    WaitUntilComBet();
                }
                else if (sender == btnCall)
                {
                    objPokerGame.DoCall(objPlayerYou);
                    WaitUntilComBet();
                }
                else
                {
                    objPokerGame.Fold(objPlayerYou);
                }
            }
            catch (InvalidCastException ex)
            {
                MessageBox.Show("Please enter a numeric value.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
 private void ButtonFold_Click(object sender, EventArgs e)
 {
     _game.Fold();
     ChangeActionButtonColor();
     MainUpdate();
     ChangeActionButtonState(false);
     EndOfHand();
 }
Exemple #3
0
 private void ButtonFold_Click(object sender, EventArgs e)
 {
     if (_game.CanCheck())
     {
         DialogResult answer = MessageBox.Show("You can check. Are you sure you wish to fold?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
         if (answer == DialogResult.No)
         {
             return;
         }
     }
     _game.Fold();
     UpdateLog();
     HandUpdate();
 }
        public void TestWinnerIfPlayerFolds()
        {
            // Arrange
            CreatePropperties();
            // Round 1
            Game.Call();
            // Round 2
            Game.Fold();

            var expected = Game.Players[1].Id;

            // Act
            var actual = Game.GetWinners(Game.Hands[Game.CurrentHandNumber() - 1]);

            // Assert
            Assert.AreEqual(expected, actual[0].Id);
        }