Esempio n. 1
0
        public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
        {
            if (_botTimeOutMilliSeconds > 0)
            {
                if (!IsBotBusy())
                {
                    _task = Task.Run(() => { RunSeeBoardCard(cardType, boardCard); });

                    // wait X amount of time for task to complete
                    if (!_task.Wait(_botTimeOutMilliSeconds))
                    {
                        // Note that the task is still running in the background
                        _bIsBotBusy = true;
                        Logger.Log("TIMEOUT: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum);
                    }
                }
                else
                {
                    // bot is busy still running the previous task
                    Logger.Log("BOT BUSY: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum);
                }
            }
            else
            {
                // timeout code disabled - just called method directly
                RunSeeBoardCard(cardType, boardCard);
            }
        }
        private void BroadcastBoardCard(EBoardCardType cardType, Card boardCard)
        {
            Logger.Log("{0} {1}", cardType, boardCard.ValueStr());

            foreach (var player in _players)
            {
                player.SeeBoardCard(cardType, boardCard);
            }
        }
Esempio n. 3
0
 private void RunSeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     try
     {
         _player.SeeBoardCard(cardType, boardCard);
     }
     catch (Exception e)
     {
         Logger.Log(string.Format("EXCEPTION: {0} Player {1} : {2}", MethodBase.GetCurrentMethod().Name, PlayerNum, e.Message));
     }
 }
Esempio n. 4
0
        private void BroadcastBoardCard(EBoardCardType cardType, Card boardCard)
        {
            foreach (var player in _allBots)
            {
                player.SeeBoardCard(cardType, boardCard);
            }

            foreach (IDisplay d in _displays)
            {
                d.DisplayBoardCard(cardType, boardCard);
            }
        }
Esempio n. 5
0
 private void RunSeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     try
     {
         Stopwatch stopWatch = new Stopwatch();
         stopWatch.Start();
         _player.SeeBoardCard(cardType, boardCard);
         stopWatch.Stop();
         _lastMethodElapsedTime = stopWatch.Elapsed;
     }
     catch (Exception e)
     {
         Logger.Log(string.Format("EXCEPTION: {0} Player {1} : {2}", MethodBase.GetCurrentMethod().Name, PlayerNum, e.Message));
     }
 }
Esempio n. 6
0
        public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
        {
            if (_botTimeOutMilliSeconds > 0)
            {
                if (!IsBotBusy())
                {
                    _task = Task.Run(() => { RunSeeBoardCard(cardType, boardCard); });

                    // wait X amount of time for task to complete
                    if (!_task.Wait(_botTimeOutMilliSeconds))
                    {
                        // Note that the task is still running in the background
                        _bIsBotBusy = true;
                        Logger.Log("TIMEOUT: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum);
                    }
                }
                else
                {
                    // bot is busy still running the previous task
                    Logger.Log("BOT BUSY: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum);
                }
            }
            else
            {
                // timeout code disabled - just called method directly
                RunSeeBoardCard(cardType, boardCard);
            }

            Stage stage = Stage.StageFlop;

            if (cardType == EBoardCardType.BoardRiver)
            {
                stage = Stage.StageRiver;
            }
            else if (cardType == EBoardCardType.BoardTurn)
            {
                stage = Stage.StageTurn;
            }

            TimingLogger.Log(string.Format("{0}, {1}, {2}, {3}, {4:0.0000}, {5}, {6}", _handNum, stage, PlayerNum, MethodBase.GetCurrentMethod().Name, (double)_lastMethodElapsedTime.Ticks / TimeSpan.TicksPerMillisecond, cardType, boardCard));
        }
Esempio n. 7
0
 public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     // this is called to inform you of the board cards (3 flop cards, turn and river)
 }
Esempio n. 8
0
 public override void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     // this is called to inform you of the board cards (3 flop cards, turn and river)
     System.Threading.Thread.Sleep(_sleepMilliSeconds);
 }
Esempio n. 9
0
 public override void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     _numRaisesThisStage = 0;
 }
Esempio n. 10
0
 public override void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     _gameState.SeeBoardCard(cardType, boardCard);
 }
Esempio n. 11
0
 public void SeeBoardCard(EBoardCardType cardType, Card communityCard)
 {
     _hand.SetCommunityCard(communityCard, cardType);
 }
Esempio n. 12
0
        private void BroadcastBoardCard(EBoardCardType cardType, Card boardCard)
        {
            Logger.Log("{0} {1}", cardType, boardCard.ValueStr());

            foreach (var player in _players)
            {
                player.SeeBoardCard(cardType, boardCard);
            }
        }
Esempio n. 13
0
        public override void SeeBoardCard(EBoardCardType cardType, Card boardCard)
        {
            // this is called to inform you of the board cards (3 flop cards, turn and river)
            _board.Add(boardCard);

            // _unseenCards.Remove(boardCard);
            _unseenList.Remove(boardCard);
            _cards.Add(boardCard);

            // if you are not alive then you don't have a hand
            if (_players[_playerNum].IsAlive && (cardType == EBoardCardType.BoardFlop3 ||
                                                 cardType == EBoardCardType.BoardTurn ||
                                                 cardType == EBoardCardType.BoardRiver))
            {
                _myBestHand = Hand.FindPlayersBestHand(_cards);

/*
 *              // Convert set of unseen cards to a list so that I can random access it
 *              List<Card> unseenList = new List<Card>();
 *
 *              foreach (Card c in _unseenCards)
 *              {
 *                  unseenList.Add(c);
 *              }
 */

                if (cardType == EBoardCardType.BoardFlop3)
                {
                    Card[] possibleBoard = new Card[5];
                    int[]  handTypeCount = new int[9];
                    int[]  results       = new int[3];

                    possibleBoard[0] = _board[0];
                    possibleBoard[1] = _board[1];
                    possibleBoard[2] = _board[2];

                    int numUnseen = _unseenList.Count;

                    // look at all possibilities for turn and river - work out my best hands
                    for (int i = 0; i < numUnseen; i++)
                    {
                        possibleBoard[3] = _unseenList[i];

                        for (int j = i + 1; j < numUnseen; j++)
                        {
                            possibleBoard[4] = _unseenList[j];
                            Hand bestHand = Hand.FindPlayersBestHand(_holeCards, possibleBoard);
                            handTypeCount[(int)bestHand.HandRank()]++;

                            // for each possible board, look at all possible hands for an opponent. Work out which hands beat yours, tie or lose to your hand

/*
 *                          for(int k=0; k<numUnseen;k++)
 *                          {
 *                              if(k!=i && k!=j)
 *                              {
 *                                  Card[] opponentHoleCards = new Card[2];
 *
 *                                  opponentHoleCards[0] = unseenList[k];
 *
 *                                  for(int l=k+1; l<numUnseen; l++)
 *                                  {
 *                                      if(l!=i && l!=j)
 *                                      {
 *                                          opponentHoleCards[1] = unseenList[l];
 *                                          Hand opponentBestHand = Hand.FindPlayersBestHand(opponentHoleCards, possibleBoard);
 *                                          results[bestHand.Compare(opponentBestHand) + 1]++;
 *                                      }
 *                                  }
 *                              }
 *                          }
 */
                        }
                    }
                }
                else if (cardType == EBoardCardType.BoardTurn)
                {
                    Card[] possibleBoard = new Card[5];
                    int[]  handTypeCount = new int[9];

                    possibleBoard[0] = _board[0];
                    possibleBoard[1] = _board[1];
                    possibleBoard[2] = _board[2];
                    possibleBoard[3] = _board[3];

                    int numUnseen = _unseenList.Count;

                    // look at all possibilities for river - work out my best hands
                    for (int i = 0; i < numUnseen; i++)
                    {
                        possibleBoard[4] = _unseenList[i];
                        Hand bestHand = Hand.FindPlayersBestHand(_holeCards, possibleBoard);
                        handTypeCount[(int)bestHand.HandRank()]++;
                    }
                }
            }
        }
Esempio n. 14
0
 public void DisplayBoardCard(EBoardCardType cardType, Card boardCard)
 {
     Logger.Log("{0} {1}", cardType, boardCard.ValueStr());
 }
Esempio n. 15
0
        public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
        {
            // update unseen card list
            UnseenCards.Remove(boardCard);
            Board.Add(boardCard);

            foreach (PlayerProfile p  in ActiveOpponents())
            {
                p.PointsForPossibleHands.RemoveHandsContaining(boardCard);
            }

            if (cardType == EBoardCardType.BoardFlop3)
            {
                InitStage(Stage.StageFlop);
            }
            else if (cardType == EBoardCardType.BoardTurn)
            {
                InitStage(Stage.StageTurn);
            }
            else if (cardType == EBoardCardType.BoardRiver)
            {
                InitStage(Stage.StageRiver);
            }

            // !!! eliminate possibilities for opponent hands

            // if you are not alive then you don't have a hand
            if (Players[MyPlayerId].IsAlive &&
                (cardType == EBoardCardType.BoardFlop3 ||
                 cardType == EBoardCardType.BoardTurn ||
                 cardType == EBoardCardType.BoardRiver)
                )
            {
                //// !!! this probably should be in the PocketCards class
                //List<Card> myCards = new List<Card>();
                //myCards.Add(MyCards.HighCard);
                //myCards.Add(MyCards.LowCard);

                // determine your best hand
//                MyBestHand = Hand.FindPlayersBestHand(MyCards.CardList, Board);

                // !!! move this bit to SeeBoardCard?
                MyHandAndBoard           = new HandAndBoard();
                MyHandAndBoard.HoleCards = MyCards;
                MyHandAndBoard.Board     = Board;
                MyHandAndBoard.Evaluate();


                // !!! determine nuts. Don't bet if your hand is far from nuts (unless bluff)?
                // !!! determine possible best hands for opponents (also include straight draws and flush draws)
                // for each possible hand ranks (that beats mine) - highest to lowest
                //      work out which pocket cards could make these (exclude cards already used on higher ranked hands)

                // for each opponent
                //      what is prob opponent hold them?

                // How to factor in draws to calc prob of winning showdown?
                // How to factor in hands of equal rank to mine?
                // Need to work through examples

                // !!! work out cards I am concerned opponent holds.
                // !!! work out good and bad cards for turn /river (cards that help me or cards that hurt me)
                // !!! calc your prob of winning showdown
            }
        }
Esempio n. 16
0
 public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
 }
Esempio n. 17
0
 public override void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     // this is called to inform you of the board cards (3 flop cards, turn and river)
     _board[(int)cardType] = boardCard;
 }
Esempio n. 18
0
 public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
 }
Esempio n. 19
0
 public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     // this is called to inform you of the board cards (3 flop cards, turn and river)
     System.Threading.Thread.Sleep(_sleepMilliSeconds);
 }
        public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
        {
            if (_botTimeOutMilliSeconds > 0)
            {
                if (!IsBotBusy())
                {
                    _task = Task.Run(() => { RunSeeBoardCard(cardType, boardCard); });

                    // wait X amount of time for task to complete
                    if (!_task.Wait(_botTimeOutMilliSeconds))
                    {
                        // Note that the task is still running in the background
                        _bIsBotBusy = true;
                        Logger.Log("TIMEOUT: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum);
                    }
                }
                else
                {
                    // bot is busy still running the previous task
                    Logger.Log("BOT BUSY: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum);
                }
            }
            else
            {
                // timeout code disabled - just called method directly
                RunSeeBoardCard(cardType, boardCard);
            }
        }
 public void SeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     // this is called to inform you of the board cards (3 flop cards, turn and river)
     int i = 1 / zero;
 }
 private void RunSeeBoardCard(EBoardCardType cardType, Card boardCard)
 {
     try
     {
         _player.SeeBoardCard(cardType, boardCard);
     }
     catch (Exception e)
     {
         Logger.Log(string.Format("EXCEPTION: {0} Player {1} : {2}", MethodBase.GetCurrentMethod().Name, PlayerNum, e.Message));
     }
 }
Esempio n. 23
0
 public void SetCommunityCard(Card card, EBoardCardType cardType)
 {
     _communityCards.Add(card);
 }
Esempio n. 24
0
        public override void SeeBoardCard(EBoardCardType cardType, Card boardCard)
        {
            // this is called to inform you of the board cards (3 flop cards, turn and river)

            // check these cards have not already been seen this hand
        }