}
return false;
}
private Bid bid(Card trump, int lead, int cardsDealt, Round round) {
Bid bid = new Bid();
int minBid = 0;
int playerCount = 0;
for (Player player: new PlayerIterator(_playerCollection, lead)) {
int notAllowedToBid = -1;
if(playerCount == this._playerCollection.size() - 1) {
boolean isPlayerWinning = isPlayerWinning(player.getId());
boolean isEven = isPlayerWinning && go.getBidType().equals(BidType.EVEN);
boolean isCanadian = isPlayerWinning && go.getBidType().equals(BidType.CANADIAN);
boolean isHardCore = cardsDealt > 3 && go.getBidType().equals(BidType.HARDCORE);
if(isEven || isCanadian || isHardCore) {
int bidSoFar = bid.bidSoFar();
if(cardsDealt - bidSoFar >= 0) {
notAllowedToBid = cardsDealt - bidSoFar;
// in canadian rules, zero is always allowed.
if(isCanadian && notAllowedToBid == 0 ) {
notAllowedToBid = -1;
}
}
//else they can bid anything
}
}
int bidInt = player.bid(trump, minBid, cardsDealt, notAllowedToBid);
if(bidInt == notAllowedToBid) {
System.err.print("illegal bid");
throw new RuntimeException("illegal bid");
}
bid.addIndividualBid(new IndividualBid(player, bidInt));
if(go.getBidType().equals(BidType.STANDARD) ||
go.getBidType().equals(BidType.EVEN) ||
go.getBidType().equals(BidType.CANADIAN) ||
go.getBidType().equals(BidType.HARDCORE)
) {