public override void StartHand(StartHandContext context)
 {
     this.UpdateCommonRow(0);
     ConsoleHelper.WriteOnConsole(this.row + 1, 2, context.MoneyLeft + "       ");
     ConsoleHelper.WriteOnConsole(this.row + 1, 10, context.FirstCard + "  ");
     ConsoleHelper.WriteOnConsole(this.row + 1, 15, context.SecondCard + "  ");
 }
Example #2
0
 public override void StartHand(StartHandContext context)
 {
     this.UpdateCommonRow(0);
     ConsoleHelper.WriteOnConsole(this.row + 1, 2, context.MoneyLeft + "       ");
     ConsoleHelper.WriteOnConsole(this.row + 1, 10, context.FirstCard + "  ");
     ConsoleHelper.WriteOnConsole(this.row + 1, 15, context.SecondCard + "  ");
 }
 // 1. pre-flop -> 2 cards for each player -> betting
 private void PreFlop()
 {
     foreach (var player in this.players)
     {
         var startHandContext = new StartHandContext();
         player.StartHand(startHandContext);
     }
 }
Example #4
0
 public override void StartHand(StartHandContext context)
 {
     is3bettedPot  = false;
     hasTheButton  = false;
     hasTopPremium = false;
     mFactor       = context.MoneyLeft / (context.SmallBlind * 2);
     base.StartHand(context);
 }
Example #5
0
        public void Play()
        {
            // Sorting players in the order of their turn for action (SB, BB, .. BTN)
            var actionPriority = new List <string>(this.players.Select(s => s.Name));

            actionPriority.Add(actionPriority.First());
            actionPriority.RemoveAt(0);

            this.Rebuy();

            // Start the hand and deal cards to each player
            foreach (var player in this.players)
            {
                var startHandContext = new StartHandContext(
                    this.deck.GetNextCard(),
                    this.deck.GetNextCard(),
                    this.handNumber,
                    player.PlayerMoney.Money,
                    this.smallBlind,
                    actionPriority);
                player.StartHand(startHandContext);
            }

            GameRoundType lastGameRoundType;

            // Pre-flop -> blinds -> betting
            this.PlayRound(GameRoundType.PreFlop, 0);
            lastGameRoundType = GameRoundType.PreFlop;

            // Flop -> 3 cards -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Flop, 3);
                lastGameRoundType = GameRoundType.Flop;
            }

            // Turn -> 1 card -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Turn, 1);
                lastGameRoundType = GameRoundType.Turn;
            }

            // River -> 1 card -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.River, 1);
                lastGameRoundType = GameRoundType.River;
            }

            this.DetermineWinnerAndAddPot(this.bettingLogic.Pot, this.bettingLogic.MainPot, this.bettingLogic.SidePots);

            foreach (var player in this.players)
            {
                player.EndHand(new EndHandContext(
                                   this.showdownCards, player.PlayerMoney.Money, lastGameRoundType));
            }
        }
Example #6
0
 public override void StartHand(StartHandContext context)
 {
    
     is3bettedPot = false;
     hasTheButton = false;
     hasTopPremium = false;
     mFactor = context.MoneyLeft / (context.SmallBlind * 2);
     base.StartHand(context);
 }
Example #7
0
        public override void StartHand(StartHandContext context)
        {
            this.Cards.Clear();
            this.Cards.Add(context.FirstCard);
            this.Cards.Add(context.SecondCard);

            this.PlayerMoney.NewHand();

            base.StartHand(context);
        }
        public override void StartHand(StartHandContext context)
        {
            base.StartHand(context);
            this.bigBlind = context.SmallBlind * 2;
            int opponentMoney = (this.startGameMoney * 2) - context.MoneyLeft;
            int smallestMoney = Math.Min(context.MoneyLeft, opponentMoney);

            this.currentGameStackStage = this.CalculateCurrentGameStackStage(context.SmallBlind, smallestMoney);
            this.roundsActions.Clear();
        }
        public override void StartHand(StartHandContext context)
        {
            this.Cards.Clear();
            this.Cards.Add(context.FirstCard);
            this.Cards.Add(context.SecondCard);

            this.PlayerMoney.NewHand();

            base.StartHand(context);
        }
Example #10
0
        public override void StartHand(StartHandContext context)
        {
            base.StartHand(context);

            this.PocketRaisePercent = PreflopHandEvaluator.GetPocketStrength(this.FirstCard, this.SecondCard);
            this.PocketStrength     = (int)(this.PocketRaisePercent * 100);
            this.OpponentMoney      = 2000 - context.MoneyLeft;
            this.BigBlind           = context.SmallBlind * 2;
            this.MyLastRaise        = 0;
        }
Example #11
0
        public void Play()
        {
            NetworkComms.AppendGlobalIncomingPacketHandler <string>("Reply", Reply);

            foreach (var player in this.players)
            {
                waitPlayer = false;
                var startHandContext = new StartHandContext(
                    this.deck.GetNextCard(),
                    this.deck.GetNextCard(),
                    this.handNumber,
                    player.PlayerMoney.Money,
                    this.smallBlind,
                    this.players[0].Name);
                player.StartHand(startHandContext);
                player.Connection.SendObject("StartHandContext", startHandContext);
                while (!waitPlayer)
                {
                    Thread.Sleep(200);
                }
            }

            this.PlayRound(GameRoundType.PreFlop, 0);

            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Flop, 3);
            }

            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Turn, 1);
            }

            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.River, 1);
            }

            this.DetermineWinnerAndAddPot(this.bettingLogic.Pot);

            foreach (var player in this.players)
            {
                waitPlayer = false;
                EndHandContext EndHandContext = new EndHandContext(this.showdownCards);
                player.EndHand(EndHandContext);

                player.Connection.SendObject("EndHandContext", EndHandContext);
                while (!waitPlayer)
                {
                    Thread.Sleep(200);
                }
            }
        }
        public override void StartHand(StartHandContext context)
        {
            this.Cards.Clear();
            this.Cards.Add(context.FirstCard);
            this.Cards.Add(context.SecondCard);

            this.CurrentlyInPot = 0;
            this.CurrentRoundBet = 0;
            this.InHand = true;

            base.StartHand(context);
        }
Example #13
0
        public override void StartHand(StartHandContext context)
        {
            this.Cards.Clear();
            this.Cards.Add(context.FirstCard);
            this.Cards.Add(context.SecondCard);

            this.CurrentlyInPot  = 0;
            this.CurrentRoundBet = 0;
            this.InHand          = true;

            base.StartHand(context);
        }
        public override void StartHand(StartHandContext context)
        {
            this.UpdateCommonRow(0);
            var dealerSymbol = context.FirstPlayerName == this.Player.Name ? "D" : " ";

            ConsoleHelper.WriteOnConsole(this.row + 1, 1, dealerSymbol, ConsoleColor.Green);
            ConsoleHelper.WriteOnConsole(this.row + 3, 2, "                            ");

            ConsoleHelper.WriteOnConsole(this.row + 1, 2, context.MoneyLeft.ToString());
            this.DrawSingleCard(this.row + 1, 10, context.FirstCard);
            this.DrawSingleCard(this.row + 1, 14, context.SecondCard);

            base.StartHand(context);
        }
        public override void StartHand(StartHandContext context)
        {
            this.UpdateCommonRow(0);
            var dealerSymbol = context.FirstPlayerName == this.Player.Name ? "D" : " ";

            ConsoleHelper.WriteOnConsole(this.row + 1, 1, dealerSymbol, ConsoleColor.Green);
            ConsoleHelper.WriteOnConsole(this.row + 3, 2, "                            ");

            ConsoleHelper.WriteOnConsole(this.row + 1, 2, context.MoneyLeft.ToString());
            this.DrawSingleCard(this.row + 1, 10, context.FirstCard);
            this.DrawSingleCard(this.row + 1, 14, context.SecondCard);

            base.StartHand(context);
        }
Example #16
0
        public override void StartHand(StartHandContext context)
        {
            if (this.currentGameTotalHandsCount != 0)
            {
                if (context.MoneyLeft > this.prevHandMoney)
                {
                    this.state.HandsWon++;
                }
            }

            this.currentGameTotalHandsCount++;
            this.state.HandsPlayed++;
            this.prevHandMoney = context.MoneyLeft;

            this.state.StartHand(context);
            base.StartHand(context);
        }
Example #17
0
        public void Play()
        {
            // Start the hand and deal cards to each player
            foreach (var player in this.players)
            {
                var startHandContext = new StartHandContext(
                    this.deck.GetNextCard(),
                    this.deck.GetNextCard(),
                    this.handNumber,
                    player.PlayerMoney.Money,
                    this.smallBlind,
                    this.players[0].Name);

                player.StartHand(startHandContext);
            }

            // Pre-flop -> blinds -> betting
            this.PlayRound(GameRoundType.PreFlop, 0);

            // Flop -> 3 cards -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Flop, 3);
            }

            // Turn -> 1 card -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Turn, 1);
            }

            // River -> 1 card -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.River, 1);
            }

            this.DetermineWinnerAndAddPot(this.bettingLogic.Pot);

            foreach (var player in this.players)
            {
                player.EndHand(new EndHandContext(this.showdownCards));
            }
        }
        public void Play()
        {
            // Start the hand and deal cards to each player
            foreach (var player in this.players)
            {
                var startHandContext = new StartHandContext(
                    this.deck.GetNextCard(),
                    this.deck.GetNextCard(),
                    this.handNumber,
                    player.PlayerMoney.Money,
                    this.smallBlind,
                    this.players[0].Name);
                player.StartHand(startHandContext);
            }

            // Pre-flop -> blinds -> betting
            this.PlayRound(GameRoundType.PreFlop, 0);

            // Flop -> 3 cards -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Flop, 3);
            }

            // Turn -> 1 card -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Turn, 1);
            }

            // River -> 1 card -> betting
            if (this.players.Count(x => x.PlayerMoney.InHand) > 1)
            {
                this.PlayRound(GameRoundType.River, 1);
            }

            this.DetermineWinnerAndAddPot(this.bettingLogic.Pot);

            foreach (var player in this.players)
            {
                // TODO: Showdown?
                player.EndHand(new EndHandContext());
            }
        }
Example #19
0
        public void Play()
        {
            // Start the hand and deal cards to each player
            foreach (var player in this.players)
            {
                var startHandContext = new StartHandContext(
                    this.deck.GetNextCard(),
                    this.deck.GetNextCard(),
                    this.handNumber,
                    player.Money,
                    this.smallBlind,
                    this.players[0].Name);
                player.StartHand(startHandContext);
            }

            // Pre-flop -> blinds -> betting
            this.PlayRound(GameRoundType.PreFlop, 0);

            // Flop -> 3 cards -> betting
            if (this.players.Count(x => x.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Flop, 3);
            }

            // Turn -> 1 card -> betting
            if (this.players.Count(x => x.InHand) > 1)
            {
                this.PlayRound(GameRoundType.Turn, 1);
            }

            // River -> 1 card -> betting
            if (this.players.Count(x => x.InHand) > 1)
            {
                this.PlayRound(GameRoundType.River, 1);
            }

            // TODO: Determine winner and give him/them the pot
            foreach (var player in this.players)
            {
                // TODO: Showdown
                player.EndHand();
            }
        }
 public override void StartHand(StartHandContext context)
 {
     // this.ourMoney = context.MoneyLeft;
     this.smallBlind = context.SmallBlind;
     this.ourSmallBlindsLeft = this.ourMoney / this.smallBlind;
     this.firstCard = context.FirstCard;
     this.secondCard = context.SecondCard;
     this.opponentType = stats.OpponentType();
     this.ourMoney = (int)context.MoneyLeft;
     stats.oppHandsCount++;
     if (ourSmallBlindsLeft >= 50)
     {
         if (stats.EnougthInfo())
         {
             if (opponentType == OpponentEvaluationType.Solid)
             {
                 this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstSolidOpponent(this.firstCard, this.secondCard);
             }
             else if (opponentType == OpponentEvaluationType.Tight)
             {
                 this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstTightOpponent(this.firstCard, this.secondCard);
             }
             else if (opponentType == OpponentEvaluationType.Wild)
             {
                 this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstWildOpponent(this.firstCard, this.secondCard);
             }
             else if (opponentType == OpponentEvaluationType.Tornado)
             {
                 this.cardPreflopStrength = FiftyBigBlindsHandStrengthValuation.PreflopAgainstTornado(this.firstCard, this.secondCard);
             }
         }
         else
         {
             this.cardPreflopStrength = HandStrengthValuation.PreFlop(this.firstCard, this.secondCard);
         }
     }
 }
Example #21
0
 /// <summary>
 /// Method used at the start of the game.
 /// </summary>
 /// <param name="context">The current context of the game.</param>
 public override void StartHand(StartHandContext context)
 {
     base.StartHand(context);
 }
Example #22
0
 public void StartHand(StartHandContext context)
 {
     this.state.StartHand(context);
 }
 public abstract void StartHand(StartHandContext context);
 public void StartHand(StartHandContext context)
 {
     this.state.StartHand(context);
 }
Example #25
0
        public override void StartHand(StartHandContext context)
        {
            base.StartHand(context);

            this.PocketRaisePercent = PreflopHandEvaluator.GetPocketStrength(this.FirstCard, this.SecondCard);
            this.PocketStrength = (int)(this.PocketRaisePercent * 100);
            this.OpponentMoney = 2000 - context.MoneyLeft;
            this.BigBlind = context.SmallBlind * 2;
            this.MyLastRaise = 0;
        }
 public override void StartHand(StartHandContext context)
 {
     ExecuteWithTimeLimit(TimeSpan.FromMilliseconds(50), () => base.StartHand(context));
 }
 public override void StartHand(StartHandContext context)
 {
     base.StartHand(context);
     handNumber = context.HandNumber;
     realBetThreshhold = context.SmallBlind * 2;
     this.thisHandEnemyRising = new Dictionary<GameRoundType, bool>();
     this.enemyCardsPrediction = null;
     this.enemyRising = false;
 }
        public override void StartHand(StartHandContext context)
        {
            if (this.currentGameTotalHandsCount != 0)
            {
                if (context.MoneyLeft > this.prevHandMoney)
                {
                    this.state.HandsWon++;
                }
            }

            this.currentGameTotalHandsCount++;
            this.state.HandsPlayed++;
            this.prevHandMoney = context.MoneyLeft;

            this.state.StartHand(context);
            base.StartHand(context);
        }
 public virtual void StartHand(StartHandContext context)
 {
     this.FirstCard = context.FirstCard;
     this.SecondCard = context.SecondCard;
 }
 public virtual void StartHand(StartHandContext context)
 {
     this.Player.StartHand(context);
 }
Example #31
0
 public virtual void StartHand(StartHandContext context)
 {
     this.FirstCard  = context.FirstCard;
     this.SecondCard = context.SecondCard;
 }
 public virtual void StartHand(StartHandContext context)
 {
     this.Player.StartHand(context);
 }