mxCostFunction costFunction = aGraph.getGenerator().getCostFunction();
mxGraphView view = aGraph.getGraph().getView();
for (int i = 0; i < possibleMoves.length; i++)
{
int currValue = (int) costFunction.getCost(new mxCellState(view, possibleMoves[i], null));
int[] currCoords = getVertexGridCoords(xDim, yDim, currValue);
int currMoveNum = getPossibleKnightMoveCount(aGraph, xDim, yDim, currCoords[0], currCoords[1]);
float currDistance = getDistanceFromGridCenter(xDim, yDim, currValue);
if ((currMoveNum < minMoveNum || (currMoveNum == minMoveNum && currDistance > biggestDistance))