Exemple #1
0
        private EstimatedAD getPlayerToActAD(Player playerToAct, BotGameState gameState)
        {
            if (gameState.getStreet() == Street.PreFlop)
            {
                var preFlopParams = new PreFlopParams(
                    gameState.getTableType(),
                    playerToAct.PreFlopPosition,
                    gameState.getNumCallers(),
                    gameState.getNumBets(),
                    gameState.numActivePlayers(),
                    playerToAct.LastAction,
                    gameState.isPlayerInPosition(gameState.getPlayerToActInd()));

                return(playerToAct.GetAD(preFlopParams));
            }
            else
            {
                var        round      = playerToAct.Round();
                ActionType prevAction = (round == 0) ? playerToAct.PrevStreetAction : playerToAct.LastAction;

                var postFlopParams = new PostFlopParams(
                    gameState.getTableType(),
                    gameState.getStreet(),
                    round,
                    prevAction,
                    gameState.getNumBets(),
                    gameState.isPlayerInPosition(gameState.getPlayerToActInd()),
                    gameState.numActivePlayers());

                return(playerToAct.GetAD(postFlopParams));
            }
        }
Exemple #2
0
        public string acceptMessageFromServer(string message)
        {
            var matchState = MatchState.Parse(message, _numPlayers);

            Console.WriteLine("Message from server: " + message);

            if (_botGameState == null)
            {
                startTheMatch(matchState.acpcHeroPosition());
            }

            if (_prevMatchState == null || _prevMatchState.handNumber != matchState.handNumber)
            {
                if (_prevMatchState != null)
                {
                    finishHand();
                }

                startNewHand(matchState.heroHoleCards(), matchState.handNumber);
            }

            if (_prevMatchState != null)
            {
                catchUpActionsFromServer(matchState.betting, matchState.heroHoleCards());
            }

            while (matchState.street > _botGameState.getStreet())
            {
                nextStreet(_botGameState.getStreet() + 1, matchState.board);
            }

            _prevMatchState = matchState;

            string responseToServer = "";

            // Is bot to act
            if (_botGameState.getPlayerToActInd() == _heroInd)
            {
                responseToServer = message + botAction();
            }

            if (responseToServer != "")
            {
                Console.WriteLine("Response to server:  " + responseToServer);
            }

            return(responseToServer);
        }