public State(int x, int y) { posX = x; posY = y; for (Action a : Action.values()) { reward.put(a, 0.0); } }
public double maxReward() { if (staticAction != null) { return staticReward; } double max = 0; for (Action a : Action.values()) { if (max == 0 || reward.get(a) > max) { max = reward.get(a); } } return max; }
public Action maxAction() { if (staticAction != null) { return staticAction; } Action max = null; for (Action a : Action.values()) { if (max == null || reward.get(a) > reward.get(max)) { max = a; } } if (reward.get(max) <= 0) return null; return max; }