Beispiel #1
0
 public bool PullOutBooks(Player player)
 {
     IEnumerable<Values> booksPulled = player.PullOutBooks();
     foreach (Values value in booksPulled)
         books.Add(value, player);
     if (player.CardCount == 0)
         return true;
     return false;
 }
Beispiel #2
0
        public bool PullOutBooks(Player player)
        {
            IEnumerable <Values> booksPulled = player.PullOutBooks();

            foreach (Values value in booksPulled)
            {
                books.Add(value, player);
            }
            if (player.CardCount == 0)
            {
                return(true);
            }
            return(false);
        }
Beispiel #3
0
 public bool PullOutBooks(Player player)
 {
     /* Pull out a player's books.  Return true if the player ran out of cards, otherwise
      * return false.  Each book is added to the Books dectionary.  A player runs out of
      * cards when he's used all of his cards to make book - and he wins the game.
      */
     foreach (Value value in player.PullOutBooks())
     {
         books.Add(value, player);
     }
     if (player.CardCount == 0)
     {
         return(true);
     }
     return(false);
 }
Beispiel #4
0
        private bool PullOutBooks(Player player)
        {
            var booksPulled = player.PullOutBooks();

            foreach (var value in booksPulled)
            {
                _books.Add(value, player);
            }

            if (player.CardCount == 0)
            {
                return(true);
            }

            return(false);
        }
Beispiel #5
0
 public bool PullOutBooks(Player player)
 {
     Values[] booksOfPlayer = player.PullOutBooks().ToArray();
     if (booksOfPlayer.Length != 0)
     {
         foreach (Values value in booksOfPlayer)
         {
             books.Add(value, player);
         }
     }
     if (player.CardCount == 0)
     {
         return(true);
     }
     return(false);
 }
Beispiel #6
0
        public bool PullOutBooks(Player player)
        {
            List <Card.Values> list = player.PullOutBooks();

            foreach (Card.Values value in list)
            {
                books.Add(value, player);
            }
            if (player.CardCount == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #7
0
        public bool PullOutBooks(Player player)
        {
            // Pull out a player's books. Return true if the player ran out of cards, otherwise
            // return false. Each book is added to the Books dictionary. A player runs out of
            // cards when he’'s used all of his cards to make books—and he wins the game.
            IEnumerable <Values> booksPulled = player.PullOutBooks();

            foreach (Values value in booksPulled)
            {
                books.Add(value, player);
            }

            if (player.CardCount == 0)
            {
                return(true);
            }
            return(false);
        }
        public bool PullOutBooks(Player player)
        {
            IEnumerable <Values> booksPulled = player.PullOutBooks();

            foreach (Values value in booksPulled)
            {
                books.Add(value, player);
            }
            OnPropertyChanged("Books");

            if (player.CardCount == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #9
0
        public bool PullOutBooks(Player player)
        {
            // Pull out a player's books. Return true if the player ran out of cards, otherwise
            // return false. Each book is added to the Books dictionary. A player runs out of
            // cards when he’'s used all of his cards to make books—and he wins the game

            IEnumerable <Values> pulledBook = player.PullOutBooks();

            // is a foreach loop for a Dictionary of one a target for improvement?  would have to extract the value otherwise
            foreach (Values value in pulledBook)
            {
                books.Add(value, player);
                textBoxOnForm.Text += $"{player.Name} scored a book of {Card.Plural(value)}.{Environment.NewLine}";
            }

            if (player.CardCount == 0)
            {
                return(true);
            }
            return(false);
        }
        public bool PullOutBooks(Player player)
        {
            /*
                Monte os books de um jogador. Retorne true se o jogador ficar sem cartas,
                se não for o caso, retorne false. Cada book deve ser adicionado ao dicionário Books.
                Um jogador fica sem cartas quando usa todas as suas restantes para montar um book
                vaza - e assim ganha o jogo.
            */

            /*****************/
            IEnumerable<Values> booksPulled = player.PullOutBooks();

            foreach (Values value in booksPulled)
                books.Add(value, player);
            /*****************/

            //player.PullOutBooks();

            if (player.CardCount == 0)
                return true;
            return false;
        }
Beispiel #11
0
 public bool PullOutBooks(Player player)
 {
     IEnumerable<Value> booksPulled = player.PullOutBooks();
     foreach (Value value in booksPulled)
     {
         this.books.Add(value, player);
     }
     if (player.CardCount == 0)
     {
         return true;
     }
     return false;
 }
Beispiel #12
0
        public bool PullOutBooks(Player player)
        {
            IEnumerable<Values> booksPulled = player.PullOutBooks();
            foreach (Values value in booksPulled)
            {
                books.Add(value, player);
            }
            OnPropertyChanged("Books");

            if (player.CardCount == 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }