public Pile GetDiscardPile(string identifier) { var discardPile = Piles.SingleOrDefault(p => p.Type == PileType.Discard && p.Identifier == identifier); if (discardPile == null) { throw new DomainException(DomainErrorCode.InconsistentData, $"No discard pile for game {Id}"); } return(discardPile); }
public Pile GetDeckPile() { var deckPile = Piles.SingleOrDefault(p => p.Type == PileType.Deck); if (deckPile == null) { throw new DomainException(DomainErrorCode.InconsistentData, "No deck pile found"); } return(deckPile); }
public Pile GetPlayerPile(Player player, string identifierSuffix) { var identifier = GetPlayerIdentifier(player, identifierSuffix); var playerPile = Piles.SingleOrDefault(p => p.Type == PileType.PlayerHand && p.Identifier == identifier); if (playerPile == null) { throw new DomainException(DomainErrorCode.InconsistentData, $"No player pile for game {Id} and player {player.Id}"); } return(playerPile); }