Writing our auction rules
The next step is to write the rules to determine the winning bid. We could write a very simple rule to find the highest bid by writing a rule condition statement such as the following:
winningBid is a TBid and there is no case where otherBid is a TBid and otherBid.maxAmount > winningBid.maxAmount
This will match the bid which has no other bids with a greater bid amount. However, if we examine the bidding rules of an auction, we can see that the highest bid doesn't always win.
The reason being that once a successful bid has been placed, the next bid has to be equal to the winning amount plus a full bid increment, otherwise it's not a valid bid. In addition, if two maximum bids are equal, then the bid that was placed first ...