Beispiel #1
0
 static int War()
 {
     if (Player1.Count < 3 || Player2.Count < 3)
     {
         isPat = true;
         return(0);
     }
     ToAddFrom1.Enqueue(Player1.Dequeue());
     ToAddFrom1.Enqueue(Player1.Dequeue());
     ToAddFrom1.Enqueue(Player1.Dequeue());
     ToAddFrom2.Enqueue(Player2.Dequeue());
     ToAddFrom2.Enqueue(Player2.Dequeue());
     ToAddFrom2.Enqueue(Player2.Dequeue());
     return(Battle());
 }
Beispiel #2
0
        static int Battle()
        {
            int card1 = Player1.Dequeue();
            int card2 = Player2.Dequeue();

            ToAddFrom1.Enqueue(card1);
            ToAddFrom2.Enqueue(card2);
            if (card1 > card2)
            {
                return(1);
            }
            else if (card1 < card2)
            {
                return(2);
            }
            else// card1 = card2
            {
                return(War());
            }
        }