private void expandForwardFrontier(Node current, ref Neighbor[] neighbors) { current.setClosedA(); var count = GetNeighbors(current, ref neighbors); for (var i = 0; i < count; i++) { var neighbor = neighbors[i].node; if (neighbor.isClosedA()) { continue; } var tentativeScore = current.costA + neighbors[i].cost; if (!neighbor.isOpenA()) { neighbor.setOpenA(); neighbor.costA = tentativeScore; neighbor.parentA = current; openA.Add(neighbor, tentativeScore); updateForwardFrontier(neighbor, tentativeScore); } else if (neighbor.costA > tentativeScore) { neighbor.costA = tentativeScore; neighbor.parentA = current; openA.Update(neighbor, tentativeScore); updateForwardFrontier(neighbor, tentativeScore); } } }