/// <summary>
/// If announcement made by this player is valid according to game rules
/// </summary>
public bool IsValid(Player player, AnnouncementTypeEnum type, bool isDoubled, bool isRedoubled)
{
//no player
if (player == null)
{
throw new ArgumentNullException("Player", "Bidding player cannot be null");
}
//legal pass
if (type == AnnouncementTypeEnum.Pass)
{
if (!isDoubled && !isRedoubled)
{
return(true);
}
else
{
return(false);
}
}
if (_lastValidAnnouncement.CompareTo(type) < 0 && !isDoubled && !isRedoubled)
{
return(true);
}
if (_lastValidAnnouncement.CompareTo(type) == 0 && !IsLastValidBidByTeam(player) && !_lastValidAnnouncement.IsReDoubled)
{
if (!_lastValidAnnouncement.IsDoubled && isDoubled && !isRedoubled)
{
return(true);
}
if (_lastValidAnnouncement.IsDoubled && !isDoubled && isRedoubled)
{
return(true);
}
}
return(false);
}