예제 #1
0
파일: Referee.cs 프로젝트: tmarkovica/Snaps
 private int FindTurnWinner_NormalGameLogic(List <Card> cards)
 {
     if (this.StartingPlayerIndex == 0)
     {
         if (NormalGameLogic.IsFirstCardWinner(cards[0], cards[1]))
         {
             return(0);
         }
         else
         {
             return(1);
         }
     }
     else
     {
         if (NormalGameLogic.IsFirstCardWinner(cards[1], cards[0]))
         {
             return(1);
         }
         else
         {
             return(0);
         }
     }
 }
예제 #2
0
        public void Process()
        {
            IGameLogic gameLogic = new NormalGameLogic();

            //Wait();

            /*
             * if (gameLogic.IsFirstCardWinner(this.tableCard1.TakeCard(), this.tableCard2.TakeCard()))
             * {
             *  oponentsTurn = false;
             *  oponentThrows = false;
             * }
             * else
             * {
             *  oponentsTurn = true;
             *  oponentThrows = true;
             * }*/
            ThrowLabelUpdate();



            SetTimer();

            //ClearHolders();
        }
예제 #3
0
        public Card CounterCard(Card card)
        {
            List <Card> cards = this.CollectCards();

            List <Card> strongerCards = new List <Card>();

            for (int i = 0; i < cards.Count; i++)
            {
                if (cards[i] != null)
                {
                    if (NormalGameLogic.IsFirstCardWinner(card, cards[i]) == false)
                    {
                        strongerCards.Add(cards[i]);
                    }
                }
            }

            if (strongerCards.Count > 0) // win
            {
                return(SeparateCardFromHandAtIndex(cards, GetIndexFrom_OfCard(cards, WeakestCardFrom(strongerCards))));
            }
            else // lose
            {
                return(SeparateCardFromHandAtIndex(cards, GetIndexFrom_OfCard(cards, WeakestCardFrom(cards))));
            }
        }