Ejemplo n.º 1
0
        PlayBestScoredMoveWithScoreChangeUpToLimitConsideringCommunication_CommunicationBlocksTwoPlays_PlayRemainingPlay()
        {
            // 28 - 38 on 30 is blocked
            // 76 on 80 is blocked
            // 8 on 2 is played
            var cards = new ReadOnlyCollection <int>(new List <int> {
                38, 28, 76, 8
            });
            var rows = TestHelper.GetPreparedRows(30, 2, 99, 80);
            var comm = new List <(int, PlayerCommunication)>
            {
                (1,
                 new PlayerCommunication(RowOfCardsIdentifier.FirstRowUp,
                                         PlayerCommunicationType.DoNotPlayHere)),
                (1,
                 new PlayerCommunication(RowOfCardsIdentifier.SecondRowDown,
                                         PlayerCommunicationType.TryNotToPlayHere))
            };
            var info = new PlayerInformation(0, 2, rows, comm);

            var expectedMove = new PlayerMove(PlayerMoveDecision.WantToPlay,
                                              new CardPlacement(RowOfCardsIdentifier.SecondRowUp, 8));

            var move = PlayerMoveRules.PlayBestScoredMoveUpToLimitConsideringCommunication(cards, info);

            Assert.That(move, Is.EqualTo(expectedMove));
        }
Ejemplo n.º 2
0
        PlayBestScoredMoveWithScoreChangeUpToLimitConsideringCommunication_PlayCardsBetweenBackwardsTrickCards_PlaysIt()
        {
            // 4, 12, 2 is better than 12, 2, 4
            var cards = new ReadOnlyCollection <int>(new List <int> {
                2, 4, 12, 13
            });
            var rows = TestHelper.GetPreparedRows(1, 80, 75, 78);
            var comm = new List <(int, PlayerCommunication)>();
            var info = new PlayerInformation(0, 2, rows, comm);

            var expectedMove = new PlayerMove(PlayerMoveDecision.WantToPlay,
                                              new CardPlacement(RowOfCardsIdentifier.FirstRowUp, 4));

            var move = PlayerMoveRules.PlayBestScoredMoveUpToLimitConsideringCommunication(cards, info);

            Assert.That(move, Is.EqualTo(expectedMove));

            cards = new ReadOnlyCollection <int>(new List <int> {
                2, 12, 13
            });
            rows         = TestHelper.GetPreparedRows(4, 80, 75, 78);
            comm         = new List <(int, PlayerCommunication)>();
            info         = new PlayerInformation(1, 2, rows, comm);
            expectedMove = new PlayerMove(PlayerMoveDecision.WantToPlay,
                                          new CardPlacement(RowOfCardsIdentifier.FirstRowUp, 12));

            move = PlayerMoveRules.PlayBestScoredMoveUpToLimitConsideringCommunication(cards, info);

            Assert.That(move, Is.EqualTo(expectedMove));
        }
Ejemplo n.º 3
0
        PlayBestScoredMoveWithScoreChangeUpToLimitConsideringCommunication_CommunicationAllowsOtherwiseBadPlay_PlayBadPlay()
        {
            // 79 on 80 would be best
            // but next players worst move would be on second row up, so 10 there is better
            var cards = new ReadOnlyCollection <int>(new List <int> {
                75, 10
            });
            var rows = TestHelper.GetPreparedRows(1, 2, 99, 80);
            var comm = new List <(int, PlayerCommunication)>
            {
                (1,
                 new PlayerCommunication(RowOfCardsIdentifier.SecondRowUp,
                                         PlayerCommunicationType.OnlyBadMoveHere))
            };
            var info = new PlayerInformation(2, 2, rows, comm);

            var expectedMove = new PlayerMove(PlayerMoveDecision.WantToPlay,
                                              new CardPlacement(RowOfCardsIdentifier.SecondRowUp, 10));

            var move = PlayerMoveRules.PlayBestScoredMoveUpToLimitConsideringCommunication(cards, info);

            Assert.That(move, Is.EqualTo(expectedMove));
        }