package sk.paz1a.practicals.task03;
import java.awt.Color;
import sk.upjs.jpaz2.*;
public class SmartTurtle extends Turtle {
public void mystery() {
Color c = null;
for (int i = 0; i < 256; i++) {
c = new Color(i, 100, 100);
this.setPenColor(c);
this.setPosition(i, 0);
this.moveTo(i, 150);
}
}
public void randomPenColor() {
int r = (int) (Math.random() * 256);
int g = (int) (Math.random() * 256);
int b = (int) (Math.random() * 256);
this.setPenColor(new Color(r, g, b));
}
public double concentricCircles(double radius) {
int counter = 0;
double totalArea = 0;
while (radius >= 0.5) {
if (counter % 3 == 0) {
this.setFillColor(Color.RED);
} else if (counter % 3 == 1) {
this.setFillColor(Color.BLUE);
} else {
this.setFillColor(Color.GRAY);
}
totalArea = totalArea + Math.PI * radius * radius;
this.dot(radius);
radius = radius * 0.8;
counter++;
}
return totalArea;
}
}