@Override
public double calculate(State resultState, State previousState,
Action desiredAction) {
if (!(resultState instanceof GridState)
|| !(previousState instanceof GridState)) {
throw new WorldError("Must be instance of GridState");
}
GridState gridResultState = (GridState) resultState;
GridState gridPreviousState = (GridState) previousState;