Example #1
0
 internal static BattleResult <CARD_VALUE> Battle(CARD_VALUE v1, CARD_VALUE v2)
 {
     if (v1.Equals(v2))
     {
         return(BattleResult <CARD_VALUE> .CreateEquality());
     }
     return(BattleResult <CARD_VALUE> .CreateWinner((CARD_VALUE)Math.Max((int)v1, (int)v2)));
 }
Example #2
0
            internal Player ResolveRound()
            {
                BattleResult <CARD_VALUE> battleResult =
                    GameWar.Battle(currentRound.Values.First(), currentRound.Values.Last());

                if (!battleResult.IsEquality)
                {
                    if (currentRound.Values.First() == battleResult.CardValue)
                    {
                        return(currentRound.Keys.First());
                    }
                    return(currentRound.Keys.Last());
                }
                return(null);
            }
Example #3
0
        public void Should_ten_lose_versus_king()
        {
            BattleResult <CARD_VALUE> winner = GameWar.Battle(CARD_VALUE.TEN, CARD_VALUE.KING);

            Assert.AreEqual(CARD_VALUE.KING, winner.CardValue);
        }
Example #4
0
        public void Should_king_card_win_versus_queen()
        {
            BattleResult <CARD_VALUE> winner = GameWar.Battle(CARD_VALUE.KING, CARD_VALUE.QUEEN);

            Assert.AreEqual(CARD_VALUE.KING, winner.CardValue);
        }