コード例 #1
0
 @OPERATION
 protected void registerAgent(OpFeedbackParam<String> wsp) {
   AgentId aid = getOpUserId();
   System.out.println("registering agent " + aid);
   super.registerAgent(wsp);
   order.add(aid);
   wsp.set("NA");
 }
コード例 #2
0
 /**
  * Operation that gives agents a linear representation of the state of the game.
  *
  * @param result
  */
 @OPERATION
 void getGameState(OpFeedbackParam<Integer[]> result) {
   Integer[] res = new Integer[9];
   for (int i = 0; i < 3; i++)
     for (int j = 0; j < 3; j++) {
       res[3 * i + j] = gameState[i][j];
     }
   result.set(res);
 }
コード例 #3
0
 @OPERATION
 void randomInt(OpFeedbackParam<Integer> res, int min, int max) {
   res.set(r.nextInt(max + 1 - min) + min);
 }
 @OPERATION
 void random_int(int min, int max, OpFeedbackParam<Integer> res) {
   Random r = new Random();
   res.set(r.nextInt((max - min + 1)) + min);
 }
 @OPERATION
 void toss_coin(double prob, OpFeedbackParam<Boolean> res) {
   Random r = new Random();
   res.set(r.nextDouble() < prob);
 }