private void PlayCards(Contract contract) { var currentPlayer = this.game.GetFirstPlayerForTheDeal(); for (int trickNumber = 1; trickNumber <= 8; trickNumber++) { var currentTrick = new Trick(contract, this.game[currentPlayer]); for (int i = 4; i > 0; i--) { if (trickNumber == 1 && contract.Type != ContractType.NoTrumps) { var combinations = this.AskForCardCombinations(currentPlayer); this.game.GameInfo.InformForCardCombinationsAnnounced(new CardCombinationsAnnouncedEventArgs(this.game[currentPlayer], combinations.Select(x => x.CombinationType))); } var playAction = this.PlayCard(currentPlayer, contract, currentTrick); currentTrick.Add(playAction.Card); this.game.GameInfo.InformForPlayedCard(new CardPlayedEventArgs(this.game[currentPlayer], playAction, currentTrick.ToList())); currentPlayer = this.game.GetNextPlayer(currentPlayer); } var trickWinner = currentTrick.WinnerPlayer; if (trickWinner == PlayerPosition.South || trickWinner == PlayerPosition.North) { this.southNorthPlayersCardsTaken.Add(currentTrick); } else { this.eastWestPlayersCardsTaken.Add(currentTrick); } if (trickNumber == 8) { // Last hand if (trickWinner == PlayerPosition.South || trickWinner == PlayerPosition.North) { this.southNorthTeamTakesLastHand = true; } else { this.southNorthTeamTakesLastHand = false; } } currentPlayer = this.game[trickWinner]; } }
private void PlayCards(Contract contract) { var currentPlayer = this.game.GetFirstPlayerForTheDeal(); for (int trickNumber = 1; trickNumber <= 8; trickNumber++) { var currentTrick = new Trick(contract, this.game[currentPlayer]); for (int i = 4; i > 0; i--) { if (trickNumber == 1 && contract.Type != ContractType.NoTrumps) { var combinations = this.AskForCardCombinations(currentPlayer); this.game.GameInfo.InformForCardCombinationsAnnounced(new CardCombinationsAnnouncedEventArgs(this.game[currentPlayer], combinations.Select(x => x.CombinationType))); } var playAction = this.PlayCard(currentPlayer, contract, currentTrick); currentTrick.Add(playAction.Card); this.game.GameInfo.InformForPlayedCard(new CardPlayedEventArgs(this.game[currentPlayer], playAction, currentTrick.ToList())); currentPlayer = this.game.GetNextPlayer(currentPlayer); } var trickWinner = currentTrick.WinnerPlayer; if (trickWinner == PlayerPosition.South || trickWinner == PlayerPosition.North) { this.southNorthPlayersCardsTaken.Add(currentTrick); } else { this.eastWestPlayersCardsTaken.Add(currentTrick); } if (trickNumber == 8) { // Last hand if (trickWinner == PlayerPosition.South || trickWinner == PlayerPosition.North) { this.southNorthTeamTakesLastHand = true; } else { this.southNorthTeamTakesLastHand = false; } } currentPlayer = this.game[trickWinner]; } }