clean up the clutter

This commit is contained in:
Leijurv 2018-09-02 07:18:57 -07:00
parent 2e22f1cf54
commit 1f97daf391
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -95,20 +95,13 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
mostRecentConsidered = currentNode; mostRecentConsidered = currentNode;
BetterBlockPos currentNodePos = currentNode.pos; BetterBlockPos currentNodePos = currentNode.pos;
numNodes++; numNodes++;
/*if ((lastPrintout + 1000) - System.nanoTime() / 1000000L < 0) {//print once a second
System.out.println("searching... at " + currentNodePos + ", considered " + numNodes + " nodes so far");
lastPrintout = System.nanoTime() / 1000000L;
}*/
if (goal.isInGoal(currentNodePos)) { if (goal.isInGoal(currentNodePos)) {
currentlyRunning = null; currentlyRunning = null;
displayChatMessageRaw("Took " + (System.nanoTime() / 1000000L - startTime) + "ms, " + numMovementsConsidered + " movements considered"); displayChatMessageRaw("Took " + (System.nanoTime() / 1000000L - startTime) + "ms, " + numMovementsConsidered + " movements considered");
return Optional.of(new Path(startNode, currentNode, numNodes)); return Optional.of(new Path(startNode, currentNode, numNodes));
} }
//long constructStart = System.nanoTime();
Movement[] possibleMovements = getConnectedPositions(currentNodePos, calcContext);//movement that we could take that start at currentNodePos, in random order Movement[] possibleMovements = getConnectedPositions(currentNodePos, calcContext);//movement that we could take that start at currentNodePos, in random order
shuffle(possibleMovements); shuffle(possibleMovements);
//long constructEnd = System.nanoTime();
//System.out.println(constructEnd - constructStart);
for (Movement movementToGetToNeighbor : possibleMovements) { for (Movement movementToGetToNeighbor : possibleMovements) {
if (movementToGetToNeighbor == null) { if (movementToGetToNeighbor == null) {
continue; continue;
@ -126,11 +119,8 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
} }
} }
} }
//long costStart = System.nanoTime();
// TODO cache cost // TODO cache cost
double actionCost = movementToGetToNeighbor.getCost(calcContext); double actionCost = movementToGetToNeighbor.getCost(calcContext);
//long costEnd = System.nanoTime();
//System.out.println(movementToGetToNeighbor.getClass() + "" + (costEnd - costStart));
numMovementsConsidered++; numMovementsConsidered++;
if (actionCost >= ActionCosts.COST_INF) { if (actionCost >= ActionCosts.COST_INF) {
continue; continue;