Exemplo n.º 1
0
        public static Hi5_Glove_Interaction_Hand_Event_Data Instance(int ObjectId, EHandType handType, EEventHandType eventType)
        {
            Hi5_Glove_Interaction_Hand_Event_Data data = new Hi5_Glove_Interaction_Hand_Event_Data();

            data.mObjectId  = ObjectId;
            data.mHandType  = handType;
            data.mEventType = eventType;
            return(data);
        }
Exemplo n.º 2
0
        public static string GetText(EHandType handType)
        {
            switch (handType)
            {
            case EHandType.Technical:
            case EHandType.Bullshit:
            case EHandType.Comment:
                return(handType.ToString());

            case EHandType.TooMuch:
                return("Too much...");

            case EHandType.NewTopic:
                return("New topic");

            default:
                return(null);
            }
        }
 public VRHandGrabber GetGrabber(EHandType type) =>
 type == EHandType.Primary ? PrimaryGrabber : SecondaryGrabber;
Exemplo n.º 4
0
        // Is this the correct place for this function?
        // This function may need to be customisable to accomodate non-standard hands
        // (e.g. round-the-corner straights, tigers, skeets etc.)
        private void _evaluate()
        {
            int i;

            _sortByRank();
            _calcRankCount();
            _calcSuitCount();

            // Is it a straight flush?
            if (IsStraightFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandStraightFlush;
                return;
            }

            // fours?
            if (IsFours(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandFours;
                return;
            }

            // full house?
            if (IsFullHouse(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandFullHouse;
                return;
            }

            // flush?
            if (IsFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandFlush;
                return;
            }

            // straight?
            if (IsStraight(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandStraight;
                return;
            }

            // threes?
            if (IsThrees(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandThrees;
                return;
            }

            // two pair?
            if (IsTwoPair(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandTwoPair;
                return;
            }

            // one pair?
            if (IsPair(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandPair;
                return;
            }

            _rank        = EHandType.HandRunt;
            _numSubRanks = 5;

            // This works because the hand is already sorted in descending order
            for (i = 0; i < 5; i++)
            {
                _subRank[i] = _cards[i].Rank;
            }
        }
Exemplo n.º 5
0
        // Is this the correct place for this function?
        // This function may need to be customisable to accomodate non-standard hands
        // (e.g. round-the-corner straights, tigers, skeets etc.)
        private void _evaluate()
        {
            int i;

            _sortByRank();
            _calcRankCount();
            _calcSuitCount();

            // Is it a straight flush?
            if (IsStraightFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandStraightFlush;
                return;
            }

            // fours?
            if (IsFours(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandFours;
                return;
            }

            // full house?
            if (IsFullHouse(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandFullHouse;
                return;
            }

            // flush?
            if (IsFlush(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandFlush;
                return;
            }

            // straight?
            if (IsStraight(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandStraight;
                return;
            }

            // threes?
            if (IsThrees(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandThrees;
                return;
            }

            // two pair?
            if (IsTwoPair(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandTwoPair;
                return;
            }

            // one pair?
            if (IsPair(ref _numSubRanks, ref _subRank))
            {
                _rank = EHandType.HandPair;
                return;
            }

            _rank = EHandType.HandRunt;
            _numSubRanks = 5;

            // This works because the hand is already sorted in descending order
            for (i = 0; i < 5; i++)
            {
                _subRank[i] = _cards[i].Rank;
            }
        }
Exemplo n.º 6
0
 public Hand(Participant participant, EHandType handType)
 {
     this.Participant = participant;
     this.HandType    = handType;
 }
 public InteractionCommandSet GetSet(EHandType handType)
 {
     return(handType == EHandType.Primary ? Primary : Secondary);
 }
Exemplo n.º 8
0
        public virtual List <Card> GetCardsThatCouldChangeResult(List <Card> unseenCards, HandAndBoard lowHand, HandAndBoard highHand)
        {
            List <Card> cards            = new List <Card>();
            PocketCards lowPocketCards   = lowHand.HoleCards;
            Hand        lowCurrBestHand  = lowHand.CurrentBestHand;
            Hand        highCurrBestHand = lowHand.CurrentBestHand;
            EHandType   lowCurrHandType  = lowCurrBestHand.HandRank();
            EHandType   highCurrHandType = highCurrBestHand.HandRank();

            // if low hand has a straight draw and high hand <= straight then add cards that would give the low hand a straight
            if (lowHand.IsStraightDraw && highHand.CurrentBestHand.HandRank() <= EHandType.HandStraight)
            {
                foreach (ERankType rank in lowHand.RanksToMakeStraight)
                {
                    cards.AddRange(unseenCards.Where(p => p.Rank == rank));
                }
            }

            // if low hand has a flush draw and high hand <= flush then add cards that would give the low hand a flush
            if (lowHand.IsFlushDraw && highHand.CurrentBestHand.HandRank() <= EHandType.HandFlush)
            {
                cards.AddRange(unseenCards.Where(p => p.Suit == lowHand.SuitToMakeFlush));
            }

/*
 *          // This should be covered by above (!!! unless high hand > flush)
 *          // if low hand has a straight flush draw then add cards that would give the low hand a straight flush
 *          if(lowHand.IsStraightFlushDraw)
 *          {
 *              foreach(Card c in lowHand.CardsToMakeStraightFlush)
 *              {
 *                  if(unseenCards.Contains(c))
 *                  {
 *                      cards.Add(c);
 *                  }
 *              }
 *          }
 */

            // Check for drawing dead
            if (highCurrHandType == EHandType.HandFours && lowCurrHandType <= EHandType.HandTwoPair)
            {
                return(cards);
            }

            if (highCurrHandType == EHandType.HandFullHouse && lowCurrHandType <= EHandType.HandPair)
            {
                return(cards);
            }

            if (highCurrHandType >= EHandType.HandTwoPair && lowCurrHandType == EHandType.HandRunt)
            {
                return(cards);
            }

            // simple check - add any card of same rank as low hand pocket cards.
            cards.AddRange(unseenCards.Where(p => p.Rank == lowPocketCards.LowCard.Rank));
            if (!lowPocketCards.IsPair)
            {
                cards.AddRange(unseenCards.Where(p => p.Rank == lowPocketCards.HighCard.Rank));
            }

            // Also need to consider edge cases where a card pairs with board card and helps low hand but not high hand - eg high hand has flush, river card pairs with board
            // gives low hand (but not high hand) a full house.
            // Another edge case is where high hand has two pair (no pocket pair, but two cards paired with cards on board) and low hand has a pocket pair that is higher than highest of two pair
            // A drawn card that pairs with a board would give you a higher two pair.
            // Always checking all board cards is too slow!

/*
 *          foreach(Card c in lowHand.Board)
 *          {
 *              cards.AddRange(unseenCards.Where(p => p.Rank == c.Rank));
 *          }
 */

            return(cards.Distinct().ToList());
        }