/**
   * Method which simulates the game from a given node/state
   *
   * @param n
   * @return
   */
  private int defaultPolicy(Node n) {
    Game currentState = n.getState().copy();
    int d = 0;

    while (!isStateTerminal(currentState) && d != depth) {
      MOVE localCurrentDirection = null;
      if (d == 0
          || currentState.isJunction(
              currentState.getPacmanCurrentNodeIndex())) { // is in a junction
        MOVE[] moves = currentState.getPossibleMoves(currentState.getPacmanCurrentNodeIndex());
        int i = rng.nextInt(moves.length);
        localCurrentDirection = moves[i];
        while (moves[i] == localCurrentDirection.opposite()) {
          i = rng.nextInt(moves.length);
        }
        localCurrentDirection = moves[i];
      }

      currentState.advanceGame(
          localCurrentDirection,
          controller.Controller.getGhostController().getMove(currentState, 0));
      d++;
    }

    if (isStateTerminal(currentState)) {
      return -1;
    }
    return currentState.getScore();
  }