Esempio n. 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;
  }
Esempio n. 2
0
 public void resetGame() {
   world.resetState();
 }
Esempio n. 3
0
 public void makeMove() {
   world.moveMouse();
   world.moveCat();
 }