Example #1
0
  @OPERATION
  public void bid(double bidValue, int count) {
    if (!getObsProperty("running").booleanValue()) failed("auction not started");

    getObsProperty("answer_count").updateValue(count + 1);

    ObsProperty opCurrentValue = getObsProperty("best_bid");
    if (bidValue < opCurrentValue.doubleValue()) { // the bid is better than
      // the previous
      opCurrentValue.updateValue(bidValue);
      chosenAgent = getOpUserName(); // the name of the agent doing this
      // operation
    }
    System.out.println("Received bid " + bidValue + " from " + getOpUserName());
  }