コード例 #1
0
        public void SetStrategicPosition_SixPlayersVaryPositions_SetsStrategicPositionCorrectly(
            [Values(0, 1, 2, 3, 4, 5)] int postion,
            [Values(
                 StrategicPositions.SB, StrategicPositions.BB, StrategicPositions.MI,
                 StrategicPositions.LT, StrategicPositions.CO, StrategicPositions.BU)] StrategicPositions expectedStrategicPosition)
        {
            _convertedPlayer.Position = postion;

            _convertedPlayer.SetStrategicPosition(SixPlayers);

            Assert.That(_convertedPlayer.StrategicPosition, Is.EqualTo(expectedStrategicPosition));
        }
コード例 #2
0
 public static string NamePosition(StrategicPositions strategicPosition)
 {
     return
         (strategicPosition.Match()
          .With(p => p == StrategicPositions.SB, _ => "the small blind")
          .With(p => p == StrategicPositions.BB, _ => "the big blind")
          .With(p => p == StrategicPositions.EA, _ => "early position")
          .With(p => p == StrategicPositions.MI, _ => "middle position")
          .With(p => p == StrategicPositions.LT, _ => "late position")
          .With(p => p == StrategicPositions.CO, _ => "the cut-off")
          .With(p => p == StrategicPositions.BU, _ => "the button")
          .Do());
 }
コード例 #3
0
        protected override void ExtractMatchingPlayers(IEnumerable <IAnalyzablePokerPlayer> analyzablePokerPlayers)
        {
            for (var position = StrategicPositions.SB; position <= StrategicPositions.BU; position++)
            {
                StrategicPositions strategicPosition = position;
                MatchingPlayers[(int)strategicPosition] =
                    (from player in analyzablePokerPlayers
                     where player.ActionSequences[(int)_street] == _actionSequence &&
                     player.StrategicPosition == strategicPosition
                     select player).ToList();
            }

            AddChecksToFoldsForBigBlindInUnraisedPot(analyzablePokerPlayers);
        }
コード例 #4
0
        public void UpdateWith_OneMatchingPlayer_MatchingPlayersForOtherPositionDoNotContainPlayer()
        {
            const long               id             = 1;
            const Streets            street         = Streets.PreFlop;
            const ActionSequences    actionSequence = ActionSequences.HeroC;
            const StrategicPositions position       = StrategicPositions.CO;

            _sut = new PreFlopActionSequenceStatistic(actionSequence);

            var player = Samples.AnalyzablePokerPlayerWith(id, actionSequence, street, position);

            _analyzablePokerPlayers.Add(player);

            _sut.UpdateWith(_analyzablePokerPlayers);

            _sut.MatchingPlayers[(int)position + 1].ShouldNotContain(player);
        }
コード例 #5
0
 public static IEnumerable <StrategicPositions> To(this StrategicPositions from, StrategicPositions to)
 {
     if (from < to)
     {
         while (from <= to)
         {
             yield return(from++);
         }
     }
     else
     {
         while (from >= to)
         {
             yield return(from--);
         }
     }
 }
コード例 #6
0
        public void UpdateWith_TwoPlayersOneMatchingPlayer_MatchingPlayersForGivenPositionContainMatchingPlayer()
        {
            const long               id             = 1;
            const Streets            street         = Streets.PreFlop;
            const ActionSequences    actionSequence = ActionSequences.HeroC;
            const StrategicPositions position       = StrategicPositions.CO;

            _sut = new PreFlopActionSequenceStatistic(actionSequence);

            var matchingPlayer    = Samples.AnalyzablePokerPlayerWith(id, actionSequence, street, position);
            var notMatchingPlayer = Samples.AnalyzablePokerPlayerWith(id + 1, actionSequence + 1, street, position);

            _analyzablePokerPlayers.Add(matchingPlayer);
            _analyzablePokerPlayers.Add(notMatchingPlayer);

            _sut.UpdateWith(_analyzablePokerPlayers);

            _sut.MatchingPlayers[(int)position].ShouldContain(matchingPlayer);
        }
コード例 #7
0
        public void Filter_OnlyStrategicPostionFilterActivated_ReturnsPlayersPassingThroughIt()
        {
            const StrategicPositions max = StrategicPositions.MI;
            var inRangePlayer            = _stub.Setup <IAnalyzablePokerPlayer>()
                                           .Get(ap => ap.StrategicPosition).Returns(max)
                                           .Out;
            var outOfRangePlayer = _stub.Setup <IAnalyzablePokerPlayer>()
                                   .Get(ap => ap.StrategicPosition).Returns(max + 1)
                                   .Out;
            var players = new List <IAnalyzablePokerPlayer> {
                inRangePlayer, outOfRangePlayer
            };

            _sut.StrategicPositionFilter.ActivateWith(0, max);

            var filteredPlayers = _sut.Filter(players);

            filteredPlayers.ShouldContain(inRangePlayer);
            filteredPlayers.ShouldNotContain(outOfRangePlayer);
        }
コード例 #8
0
        public static IAnalyzablePokerPlayer AnalyzablePokerPlayerWith(long id, ActionSequences actionSequence, Streets street, StrategicPositions strategicPosition)
        {
            var analyzablePokerPlayer = (AnalyzablePokerPlayer)AnalyzablePokerPlayerWith(id, actionSequence, street, false);

            analyzablePokerPlayer.StrategicPosition = strategicPosition;
            return(analyzablePokerPlayer);
        }
コード例 #9
0
 public AnalyzablePokerPlayerMock(long id, int handId, string holecards, int mBefore, int position, StrategicPositions strategicPosition, bool?inPositionPreFlop, bool?inPositionFlop, bool?inPositionTurn, bool?inPositionRiver, ActionSequences actionSequencePreFlop, ActionSequences actionSequenceFlop, ActionSequences actionSequenceTurn, ActionSequences actionSequenceRiver, int betSizeIndexFlop, int betSizeIndexTurn, int betSizeIndexRiver, double bb, double ante, DateTime timeStamp, int totalPlayers, int playersInFlop, string sequencePreFlop, string sequenceFlop, string sequenceTurn, string sequenceRiver)
     : base(
         id,
         handId,
         holecards,
         mBefore,
         position,
         strategicPosition,
         inPositionPreFlop,
         inPositionFlop,
         inPositionTurn,
         inPositionRiver,
         actionSequencePreFlop,
         actionSequenceFlop,
         actionSequenceTurn,
         actionSequenceRiver,
         betSizeIndexFlop,
         betSizeIndexTurn,
         betSizeIndexRiver,
         bb,
         ante,
         timeStamp,
         totalPlayers,
         playersInFlop,
         sequencePreFlop,
         sequenceFlop,
         sequenceTurn,
         sequenceRiver)
 {
 }
コード例 #10
0
 protected static string LetValidSutDecribePositions(StrategicPositions fromPosition, StrategicPositions toPosition)
 {
     _validPositions = Tuple.New(fromPosition, toPosition);
     return(_sut.Describe("fred", _analyzablePokerPlayerStub.Object, Streets.PreFlop, _validPositions));
 }
コード例 #11
0
        public AnalyzablePokerPlayer(
            long id,
            int handId,
            string holecards,
            int mBefore,
            int position,
            StrategicPositions strategicPosition,
            bool?inPositionPreFlop,
            bool?inPositionFlop,
            bool?inPositionTurn,
            bool?inPositionRiver,
            ActionSequences actionSequencePreFlop,
            ActionSequences actionSequenceFlop,
            ActionSequences actionSequenceTurn,
            ActionSequences actionSequenceRiver,
            int betSizeIndexFlop,
            int betSizeIndexTurn,
            int betSizeIndexRiver,
            double bb,
            double ante,
            DateTime timeStamp,
            int totalPlayers,
            int playersInFlop,
            string sequencePreFlop,
            string sequenceFlop,
            string sequenceTurn,
            string sequenceRiver)
            : this()
        {
            Id                = id;
            HandId            = handId;
            Holecards         = holecards;
            MBefore           = mBefore;
            Position          = position;
            StrategicPosition = strategicPosition;

            InPosition[(int)Streets.PreFlop] = inPositionPreFlop;
            InPosition[(int)Streets.Flop]    = inPositionFlop;
            InPosition[(int)Streets.Turn]    = inPositionTurn;
            InPosition[(int)Streets.River]   = inPositionRiver;

            ActionSequences[(int)Streets.PreFlop] = actionSequencePreFlop;
            ActionSequences[(int)Streets.Flop]    = actionSequenceFlop;
            ActionSequences[(int)Streets.Turn]    = actionSequenceTurn;
            ActionSequences[(int)Streets.River]   = actionSequenceRiver;

            BetSizeIndexes[(int)Streets.Flop]  = betSizeIndexFlop;
            BetSizeIndexes[(int)Streets.Turn]  = betSizeIndexTurn;
            BetSizeIndexes[(int)Streets.River] = betSizeIndexRiver;

            BB            = bb;
            Ante          = ante;
            TimeStamp     = timeStamp;
            TotalPlayers  = totalPlayers;
            PlayersInFlop = playersInFlop;

            _sequenceStrings[(int)Streets.PreFlop] = sequencePreFlop;
            _sequenceStrings[(int)Streets.Flop]    = sequenceFlop;
            _sequenceStrings[(int)Streets.Turn]    = sequenceTurn;
            _sequenceStrings[(int)Streets.River]   = sequenceRiver;
        }