private static bool IsStraightFoundation(long hand) { CardsCount = new Dictionary<long, int>(); var isStraight = false; long straightMask = 0x1F00; // 1 1111 0000 0000 const long exceptionStraightMask = 0x100F; // 1 0000 0000 1111 Kickers = new long[1]; var clubs = new Club(hand); for (var i = 0; i < (clubs.MaxSuitCards - 4); i++) { var total = hand & straightMask; if (straightMask == total) { isStraight = true; Kickers[0] = BinaryOperations.GetTheMostRightSetBit(straightMask); // Set the highest card of the straight as the kicker break; } straightMask >>= 1; } // Special Straight (ace is the bit of the highest weight and could match a straight with the four lowest bits if (!isStraight && exceptionStraightMask == (hand & exceptionStraightMask)) { isStraight = true; Kickers[0] = 0x1; } return isStraight; }
private static void CreateSuitsFromHand(long hand) { _clubs = new Club(hand); _diamonds = new Diamond(hand); _spades = new Spade(hand); _hearts = new Heart(hand); }