private void drawCells (Graphics2D g2d) {
        for (int i = 0; i < fieldWidth; i++) {
            int paintX = i * cellSize;
            for (int j = 0; j < fieldHeight; j++) {
                int paintY = j * cellSize;

                if (isCellOpened(new Point(i, j)) && !(alg.getCell(i, j) instanceof StartCell)) {
                    g2d.setColor(OPENED_CELLS_COLOR);
                    g2d.fillRect(paintX, paintY, cellSize, cellSize);

                } else if (isCellClosed(new Point(i, j)) && !(alg.getCell(i, j) instanceof StartCell)) {
                    Point endCell = alg.getEndCell();
                    Point cell = new Point(i, j);

                    double lenColor = getLength(cell, endCell);

                    double alpha = 255 - (lenColor / (lengthFromStartToEnd / 100)) * (255 / 100);
                    alpha = alpha < 0 ? 0 : alpha;

                    Color closedCellGradientColor = new Color(CLOSED_CELLS_COLOR.getRed(), CLOSED_CELLS_COLOR.getGreen(), CLOSED_CELLS_COLOR.getBlue(), (int) alpha);

                    g2d.setColor(closedCellGradientColor);
                    g2d.fillRect(paintX, paintY, cellSize, cellSize);

                } else {
                    g2d.setColor(alg.getCell(i, j).getFillColor());
                    g2d.fillRect(paintX, paintY, cellSize, cellSize);
                }

                g2d.setColor(BORDER_COLOR);
                g2d.drawRect(paintX, paintY, cellSize, cellSize);
            }
        }
    }