Ejemplo n.º 1
0
        public void NewHand(databaseCache.pokerHand pokerHand)
        {
            databaseChangesSinceLastSnapshot = true;

            if (useRAMOnly)
            {
                //Takes a hand and returns that hand with an attached handId
                pokerHand.HandId = NewHandId();
                lock (handLocker)
                {
                    if (pokerHands.ContainsKey(pokerHand.TableId))
                    {
                        pokerHands[pokerHand.TableId].Add(pokerHand.HandId, pokerHand);
                    }
                    else
                    {
                        pokerHands.Add(pokerHand.TableId, new SortedDictionary <long, databaseCache.pokerHand>()
                        {
                            { pokerHand.HandId, pokerHand }
                        });
                    }
                }
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Rather than take holeCards and actions one at a time we can optimize by just taking them once at the end of the hand
        /// </summary>
        /// <param name="holeCards"></param>
        /// <param name="handActions"></param>
        public void EndHand(databaseCache.pokerHand pokerHand, List <databaseCache.holeCard> holeCards, List <databaseCache.handAction> handActions)
        {
            databaseChangesSinceLastSnapshot = true;
            PokerHandInfo handInfo = new PokerHandInfo(pokerHand, holeCards, handActions);

            //So that we can keep an easy count on the number of current commit tasks we increment here
            lock (runningSubmitLocker)
                runningSubmitCounter++;

            //We use tasks to do the heavy lifting
            if (ConcurrencyMode.Concurrency == ConcurrencyMode.ConcurencyModel.MultiCore)
            {
                Task.Factory.StartNew(HandlePokerHandInfoItem, handInfo);
            }
            else
            {
                HandlePokerHandInfoItem(handInfo);
            }
        }
Ejemplo n.º 3
0
 public PokerHandInfo(databaseCache.pokerHand pokerHand, List <databaseCache.holeCard> holeCards, List <databaseCache.handAction> handActions)
 {
     this.pokerHand   = pokerHand;
     this.holeCards   = holeCards;
     this.handActions = handActions;
 }