Exemplo n.º 1
0
        private bool PlayReserveCardToBuild(Board board)
        {
            Card topReserveCard = board.GetReservePile(this).Top;

            foreach (Pile buildPile in board.BuildPiles)
            {
                int playedValue;
                if (buildPile.IsLegalPlay(topReserveCard, buildPile, out playedValue))
                {
                    board.GetReservePile(this).Top.PlayedValue = playedValue;
                    board.DoPlay(new Play(board.GetReservePile(this), buildPile));
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 private bool PlayCardFromHandToBuild(Board board)
 {
     foreach (Pile pile in board.BuildPiles)
     {
         Pile hand = board.GetHand(this);
         foreach (Card card in hand)
         {
             int playedValue;
             if (pile.IsLegalPlay(card, pile, out playedValue))
             {
                 card.PlayedValue = playedValue;
                 board.DoPlay(new Play(hand, card, pile));
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 3
0
 private bool PlayCardFromHandToBuild(Board board)
 {
     foreach (Pile pile in board.BuildPiles)
     {
         Pile hand = board.GetHand(this);
         foreach (Card card in hand)
         {
             int playedValue;
             if (pile.IsLegalPlay(card, pile, out playedValue))
             {
                 card.PlayedValue = playedValue;
                 board.DoPlay(new Play(hand, card, pile));
                 return(true);
             }
         }
     }
     return(false);
 }
Exemplo n.º 4
0
 private bool PlayFromDiscardPileToBuild(Board board)
 {
     foreach (Pile discardPile in board.GetDiscardPiles(this))
     {
         if (discardPile.HasCards)
         {
             foreach (Pile buildPile in board.BuildPiles)
             {
                 int playedValue;
                 if (buildPile.IsLegalPlay(discardPile.Top, buildPile, out playedValue))
                 {
                     discardPile.Top.PlayedValue = playedValue;
                     board.DoPlay(new Play(discardPile, buildPile));
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Exemplo n.º 5
0
 private bool PlayFromDiscardPileToBuild(Board board)
 {
     foreach (Pile discardPile in board.GetDiscardPiles(this))
     {
         if (discardPile.HasCards)
         {
             foreach (Pile buildPile in board.BuildPiles)
             {
                 int playedValue;
                 if (buildPile.IsLegalPlay(discardPile.Top, buildPile, out playedValue))
                 {
                     discardPile.Top.PlayedValue = playedValue;
                     board.DoPlay(new Play(discardPile, buildPile));
                     return true;
                 }
             }
         }
     }
     return false;
 }
Exemplo n.º 6
0
 protected void Discard(Board board)
 {
     // Select first card in hand and discard to random pile
     board.DoPlay(new Play(board.GetHand(this), board.GetDiscardPiles(this)[Utility.Random().Next(Board.NumDiscardPiles)]));
 }
Exemplo n.º 7
0
 private bool PlayReserveCardToBuild(Board board)
 {
     Card topReserveCard = board.GetReservePile(this).Top;
     foreach (Pile buildPile in board.BuildPiles)
     {
         int playedValue;
         if (buildPile.IsLegalPlay(topReserveCard, buildPile, out playedValue))
         {
             board.GetReservePile(this).Top.PlayedValue = playedValue;
             board.DoPlay(new Play(board.GetReservePile(this), buildPile));
             return true;
         }
     }
     return false;
 }
Exemplo n.º 8
0
 protected void Discard(Board board)
 {
     // Select first card in hand and discard to random pile
     board.DoPlay(new Play(board.GetHand(this), board.GetDiscardPiles(this)[Utility.Random().Next(Board.NumDiscardPiles)]));
 }