Ejemplo n.º 1
0
        public void PlayTricks()
        {
            // person to the left of the bidder starts
            int currentPlayerIndex = (this.auction.ContractPlayerIndex() + (this.nummaOfPlayers + 1)) % this.nummaOfPlayers;

            for (int i = 0; i < this.nummaOfTricks; i++)
            {
                Trick currentTrick = new Trick(this.nummaOfPlayers);

                //currentPlayerIndex %= this.nummaOfPlayers;
                for (int j = currentPlayerIndex; j < currentPlayerIndex + this.nummaOfPlayers; j++)
                {
                    currentTrick = this.NextCardInTrick(j % this.nummaOfPlayers, currentTrick);
                }

                currentPlayerIndex = currentTrick.TrickWinner();
                // increment the number of tricks taken if it was taken by the right team
                //this.tricksTakenByBidWinners = ( this.AuctionWinners(currentPlayerIndex) ? this.tricksTakenByBidWinners + 1 : this.tricksTakenByBidWinners );

                if (this.AuctionWinners(currentPlayerIndex))
                {
                    this.tricksTakenByBidWinners++;
                    Console.WriteLine("the winners of the bid have now gotten " + this.tricksTakenByBidWinners + " tricks.");
                }

                this.allTricks[i] = currentTrick;
                Console.WriteLine("End of trick " + (i + 1) + ": Player " + (currentPlayerIndex + 1) + " took the trick with: " + currentTrick.WinningTrick().ToString());
                currentTrick.PrintRecord();
            }
        }