Ejemplo n.º 1
0
        internal static PlayerMove PlayBackwardsTrick(IReadOnlyCollection <int> cardsInHand, PlayerInformation info)
        {
            var backwardsPlays = PlayerRulesUtils.FindPlaysForBackwardTrick(cardsInHand, info.RowsOfCards);

            if (backwardsPlays.Count > 0)
            {
                return(new PlayerMove(PlayerMoveDecision.WantToPlay,
                                      new CardPlacement(backwardsPlays.First().Key, backwardsPlays.First().Value)));
            }

            return(new PlayerMove(PlayerMoveDecision.Undecided));
        }
        internal static List <PlayerCommunication> CommunicateBackwardsTrick(
            IReadOnlyCollection <int> cardsInHand, PlayerInformation info)
        {
            if (cardsInHand.Count == 0)
            {
                return(new List <PlayerCommunication>());
            }

            return(PlayerRulesUtils.FindPlaysForBackwardTrick(cardsInHand, info.RowsOfCards).Keys.Distinct()
                   .Select(row => new PlayerCommunication(row, PlayerCommunicationType.DoNotPlayHere))
                   .ToList());
        }