// While we still have nodes to explore
while (!openSet.isEmpty()){
// Get the node with the lowest f-score from the priority queue
Node current = openSet.poll();
Square currentSquare = current.getSquare();
// If we've found the goal, return the path we took to get there
if (currentSquare.equals(end))
return reconstructPath(currentSquare);
// Add current to closedset, and move the chess piece to that square
closedSet.add(currentSquare);
chessPiece.move(currentSquare);