public class Circle extends Shape {
int row;
int column;
int radius;
char drawChar;
String shape;
public Circle(int rowBase, int colBase, int rd, char drawingCharacter){
row = rowBase;
column = colBase;
radius = rd;
drawChar = drawingCharacter;
shape = "circle";
}
@Override
void draw(Window window){
int height = window.height;
int width = window.width;
int rowN = row;
int rowN2 = row;
int colN = column;
int colN2 = column;
for (int i = 0; i <= radius/2 ; i++){
if ((row-i > 0 && row-i < height-1) && (column-radius > 0 && column-radius < width-1)){
window.screen[row-i][column-radius] = drawChar;
}
if ((row-i > 0 && row-i < height-1) && (column+radius > 0 && column+radius < width-1)){
window.screen[row-i][column+radius] = drawChar;
}
if ((row+i > 0 && row+i < height-1) && (column+radius > 0 && column+radius < width-1)){
window.screen[row+i][column+radius] = drawChar;
}
if ((row+i > 0 && row+i < height-1) && (column-radius > 0 && column-radius < width-1)){
window.screen[row+i][column-radius] = drawChar;
}
if ((row-radius > 0 && row-radius < height-1) && (column-i > 0 && column-i < width-1)){
window.screen[row-radius][column-i] = drawChar;
}
if ((row+radius > 0 && row+radius < height-1) && (column-i > 0 && column-i < width-1)){
window.screen[row+radius][column-i] = drawChar;
}
if ((row+radius > 0 && row+radius < height-1) && (column+i > 0 && column+i < width-1)){
window.screen[row+radius][column+i] = drawChar;
}
if ((row-radius > 0 && row-radius < height-1) && (column+i > 0 && column+i < width-1)){
window.screen[row-radius][column+i] = drawChar;
}
}
int inddec = 1;
for (int i = radius/2 + 1; i < radius; i++){
if ((row-i > 0 && row-i < height-1) && (column-radius+inddec > 0 && column-radius+inddec < width-1)){
window.screen[row-i][column-radius+inddec] = drawChar;
}
if ((row-i > 0 && row-i < height-1) && (column+radius-inddec > 0 && column+radius-inddec < width-1)){
window.screen[row-i][column+radius-inddec] = drawChar;
}
if ((row+i > 0 && row+i < height-1) && (column-radius+inddec > 0 && column-radius+inddec < width-1)){
window.screen[row+i][column-radius+inddec] = drawChar;
}
if ((row+i > 0 && row+i < height-1) && (column+radius -inddec> 0 && column+radius-inddec < width-1))
window.screen[row+i][column+radius-inddec] = drawChar;
inddec += 1;
}
}
@Override
String getInfo(){
String result = "circle\n";
result += String.valueOf(row) + " " + String.valueOf(column) + " " + String.valueOf(radius) + "\n";
result += drawChar;
result += "\n.\n";
return result;
}
}