private void countPath () {
        Point currentCell = endCell;
        path.add(currentCell);

        while (!(field[currentCell.x][currentCell.y] instanceof StartCell)) {
            Point parentCell = field[currentCell.x][currentCell.y].getParent();

            if (currentCell.x == parentCell.x || currentCell.y == parentCell.y) {
                pathLength += DIRECT_TRANSFER;
            } else {
                pathLength += DIAGONAL_TRANSFER;
            }

            currentCell = parentCell;

            path.add(currentCell);
        }
    }