public boolean place(int x, int y) { //if all squares are free, place ship and placed == true. if not, return false
        if (randomAlignment() == true) {
            x = randomWithRange(0,6);
            for (int i = x; i < x + 4; i++) {
                if (!Grid.isSquareEmpty(i, y)) {
                    Grid.addToSquare(i, y, this);
                    position[i][y] = 1;
                } else {
                    return false;
                }
            }
        } else {
            y = randomWithRange(0,6);
            for (int i = y; i < y + 4; i++) {
                if (!Grid.isSquareEmpty(x, i)) {
                    Grid.addToSquare(x, i, this);
                    position[x][i] = 1;
                } else {
                    return false;
                }
            }
        }
        Grid.addShipToGrid();
        placed = true;
        return true;
    }