Ejemplo n.º 1
0
 public bool IsValidMove(DeckRegularDict <RegularSimpleCard> thisCol)
 {
     if (Test !.AllowAnyMove == true)
     {
         return(true);
     }
     return(thisCol.First().Value == thisCol.Last().Value);
 }
        public static DeckRegularDict <SalaryInfo> GetSalaryList(this CustomBasicList <int> tempList, PlayerCollection <LifeBoardGamePlayerItem> playerList)
        {
            DeckRegularDict <SalaryInfo> newList = new DeckRegularDict <SalaryInfo>();

            foreach (var thisItem in tempList)
            {
                if (thisItem.SomeoneHasCard(playerList) == false)
                {
                    newList.Add(CardsModule.GetSalaryCard(thisItem));
                    newList.Last().IsUnknown = true;
                }
            }
            return(newList);
        }
        private int WhoWonTrick(DeckObservableDict <HorseshoeCardGameCardInformation> thisCol)
        {
            if (thisCol.Count != 4)
            {
                throw new BasicBlankException("Must have 4 cards for the trick list to see who won");
            }
            var thisCard           = thisCol.First();
            int begins             = thisCard.Player;
            EnumCardValueList nums = thisCard.Value;

            if (thisCol.All(Items => Items.Value == nums))
            {
                return(begins);
            }
            DeckRegularDict <HorseshoeCardGameCardInformation> playerStarted = new DeckRegularDict <HorseshoeCardGameCardInformation>();
            DeckRegularDict <HorseshoeCardGameCardInformation> otherPlayer   = new DeckRegularDict <HorseshoeCardGameCardInformation>();

            playerStarted.Add(thisCol.First());
            playerStarted.Add(thisCol.Last());
            otherPlayer.Add(thisCol[1]);
            otherPlayer.Add(thisCol[2]);
            HorseshoeCardGameCardInformation firstCard  = playerStarted.First();
            HorseshoeCardGameCardInformation secondCard = playerStarted.Last();
            EnumSuitList      whichSuit = firstCard.Suit;
            EnumCardValueList pairAmount;
            EnumCardValueList highestSuitNumber = EnumCardValueList.None;
            int possibleWinPlayer = 0;

            if (firstCard.Value == secondCard.Value)
            {
                pairAmount = firstCard.Value;
            }
            else
            {
                pairAmount = EnumCardValueList.None;
                var card = thisCol.Where(x => x.Suit == whichSuit).OrderByDescending(x => x.Value).Take(1).Single();
                highestSuitNumber = card.Value;
                possibleWinPlayer = card.Player;
                //if (secondCard.Value > firstCard.Value && secondCard.Suit == firstCard.Suit)
                //    highestSuitNumber = secondCard.Value;
                //else if (secondCard.Suit == firstCard.Suit)
                //    highestSuitNumber = firstCard.Value;
            }
            firstCard  = otherPlayer.First();
            secondCard = otherPlayer.Last();
            if (firstCard.Value != secondCard.Value && pairAmount > 0)
            {
                return(begins);
            }
            if (firstCard.Value == secondCard.Value)
            {
                if (firstCard.Value > pairAmount)
                {
                    if (begins == 1)
                    {
                        return(2);
                    }
                    return(1);
                }
            }
            if (pairAmount > 0)
            {
                return(begins);
            }

            if (possibleWinPlayer == 0)
            {
                throw new BasicBlankException("Sombody had to win it");
            }
            return(possibleWinPlayer);
            //if (firstCard.Suit == whichSuit)
            //{
            //    if (firstCard.Value > highestSuitNumber)
            //    {
            //        if (begins == 1)
            //            return 2;
            //        return 1;
            //    }
            //}
            //if (secondCard.Suit == whichSuit)
            //{
            //    if (secondCard.Value > highestSuitNumber)
            //    {
            //        if (begins == 1)
            //            return 2;
            //        return 1;
            //    }
            //}
            //return begins;
        }