コード例 #1
0
  public void runGame() {
    while (!world.endGame()) {
      // System.out.println("Game playing. Making move.");
      int action = -1;
      if (mousetype == GREEDY) {
        action = world.mouseAction();
      } else if (mousetype == SMART) {
        action = policy.getBestAction(world.getState());
      } else {
        System.err.println("Invalid mouse type:" + mousetype);
      }
      world.getNextState(action);

      // a.updateBoard();

      try {
        sleep(delay);
      } catch (InterruptedException e) {
        System.out.println("interrupted.");
      }
    }

    // turn off gameOn flag if only single game
    if (single) gameOn = false;
  }
コード例 #2
0
 public void resetGame() {
   world.resetState();
 }
コード例 #3
0
 public void makeMove() {
   world.moveMouse();
   world.moveCat();
 }