@Override
  public ACTIONS act(StateObservation stateObs, ElapsedCpuTimer elapsedTimer) {
    Tuple current = new Tuple();

    if (stateObs.getAvailableActions().contains(ACTIONS.ACTION_USE)) {
      current.values.add(1.0);
    } else {
      current.values.add(0.0);
    }
    if (stateObs.getAvailableActions().contains(ACTIONS.ACTION_UP)
        || stateObs.getAvailableActions().contains(ACTIONS.ACTION_DOWN)) {
      current.values.add(1.0);
    } else {
      current.values.add(0.0);
    }

    Vector2d avatarPosition = stateObs.getAvatarPosition();

    analyzeData(stateObs.getResourcesPositions(), avatarPosition, current);
    analyzeData(stateObs.getNPCPositions(), avatarPosition, current);
    analyzeData(stateObs.getImmovablePositions(), avatarPosition, current);
    analyzeData(stateObs.getMovablePositions(), avatarPosition, current);
    analyzeData(stateObs.getPortalsPositions(), avatarPosition, current);

    current.normalize(maxValues);

    for (int i = 0; i < tuples.size(); i++) {
      tuples.get(i).getDistance(current);
    }
    Collections.sort(tuples);

    HashMap<Types.ACTIONS, Integer> output = new HashMap<Types.ACTIONS, Integer>();
    output.put(Types.ACTIONS.ACTION_LEFT, 0);
    output.put(Types.ACTIONS.ACTION_RIGHT, 0);
    output.put(Types.ACTIONS.ACTION_DOWN, 0);
    output.put(Types.ACTIONS.ACTION_UP, 0);
    output.put(Types.ACTIONS.ACTION_USE, 0);

    for (int i = 0; i < k; i++) {
      output.put(tuples.get(i).output, output.get(tuples.get(i).output) + 1);
    }

    Types.ACTIONS resultAction = Types.ACTIONS.ACTION_NIL;
    int maxValue = -1;
    for (Entry<Types.ACTIONS, Integer> e : output.entrySet()) {
      if (maxValue < e.getValue()) {
        resultAction = e.getKey();
        maxValue = e.getValue();
      }
    }

    return resultAction;
  }
 private ArrayList<Observation>[] getObservables(StateObservation state) {
   switch (this.obsType) {
     case IMMOVABLE:
       return state.getImmovablePositions();
     case MOVABLE:
       return state.getMovablePositions();
     case NPC:
       return state.getNPCPositions();
     case PORTAL:
       return state.getPortalsPositions();
     case RESOURCE:
       return state.getResourcesPositions();
     default:
       return state.getPortalsPositions();
   }
 }