Beispiel #1
0
  public Price getMedianJudgedValue(int round) throws ScoreException {
    Quantity totalValue = Quantity.ZERO;
    int judgeCount = 0;
    for (Iterator iterator = playerNameIterator(); iterator.hasNext(); ) {
      Judge judge = getJudgeOrNull((String) iterator.next());
      if (judge == null || judge.isDormant(getCurrentRound())) {
        continue;
      }
      Price estimate = judge.getEstimate(round);
      if (estimate == null) {
        continue;
      }

      totalValue = totalValue.plus(estimate);
      judgeCount += 1;
    }
    if (judgeCount == 0) {
      if (cuttingOffJudges()) {
        return Price.dollarPrice(50);
      }
      String message =
          "Judges have not entered estimates for " + getRoundLabel() + " " + round + ".";
      appendToErrorMessage(message);
      throw new ScoreException(message);
    } else {
      return marketPrice(totalValue.div(judgeCount));
    }
  }
Beispiel #2
0
 protected Quantity bookFundingRequired(Properties props) {
   String playersProperty = props.getProperty(PLAYERS_PROPNAME);
   Quantity playerCount = new Quantity(playersProperty.split(COMMA_SPLIT_RE).length);
   Quantity maxTickets = initialTraderTickets().min(initialManipulatorTickets());
   return maxTickets.times(playerCount.times(new Quantity(rounds())));
 }