Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter name of player1:");
            string name1 = Console.ReadLine();
            Console.WriteLine("Enter name of player2:");
            string name2 = Console.ReadLine();

            var game = new FemKort(new Player(name1), new Player(name2));
            game.ShuffleAndDeal();

            while (game.GetWinner() == null)
            {
                Console.WriteLine("Your hand {0}:", game.CurrentHand.Player.Name);

                DisplayHand(game.CurrentHand);

                Console.WriteLine("Play your card {0}", game.CurrentHand.Player.Name);
                string shortName = Console.ReadLine();

                var card2 = game.CurrentHand.GetCardByShortName(shortName);
                if(card2 == null)
                {
                    Console.WriteLine("Invalid card");
                }
                else
                {
                    game.PlayRound(game.CurrentHand.Player, game.CurrentHand.PlayCard(shortName));
                    Console.WriteLine("You played card: " + card2.Name);
                }
            }
            Console.WriteLine("Winner is {0} with {1} wins", game.GetWinner().Item1.Name, game.GetWinner().Item2);
        }
Ejemplo n.º 2
0
 public void StartGame(string name1, string name2)
 {
     Caller.name = name1;
     var player1 = new Player(name1);
     var player2 = new Player(name2);
     _femKort = new FemKort(player1, player2);
     _femKort.ShuffleAndDeal();
     Caller.DrawHandCaller(_femKort.Hand1);
     Clients.DrawHand(name1, _femKort.Hand2);
 }
Ejemplo n.º 3
0
        public void SetupTest()
        {
            var game = new FemKort(new Player("1"), new Player("2"));

            game.ShuffleAndDeal();

            Assert.Equal(42, game.Deck.Cards.Count());

            Assert.Equal(5, game.Hand1.CardCount);
            Assert.Equal(5, game.Hand2.CardCount);
        }
Ejemplo n.º 4
0
        public void PlayRoundTest()
        {
            var game = new FemKort(new Player("1"), new Player("2"));
            game.ShuffleAndDeal();

            game.PlayRound(game.Hand1.Player, game.Hand1.PlayCard(0));
            game.PlayRound(game.Hand2.Player, game.Hand2.PlayCard(0));

            Assert.Equal(1, game.Rounds.Count());
            Assert.True(game.Rounds.First().GetWinner() != null);
        }