package sk.paz1a.practicals.task1;
import java.awt.Color;
import sk.upjs.jpaz2.*;
public class SmartTurtle extends Turtle {
// put new methods here
public void square(double size) {
this.rectangle(size, size);
}
public void triangle(double size) {
for (int i = 0; i < 3; i++) {
this.step(size);
this.turn(120);
}
}
public void rgbTriangle(double size) {
this.setPenWidth(2);
this.setPenColor(Color.RED);
this.turn(120);
this.step(size);
this.setPenColor(Color.GREEN);
this.turn(120);
this.step(size);
this.setPenColor(Color.BLUE);
this.turn(120);
this.step(size);
}
public void rectangle(double width, double height) {
for (int i = 0; i < 2; i++) {
this.step(height);
this.turn(90);
this.step(width);
this.turn(90);
}
}
public void filledSquare(double size) {
this.openPolygon();
for (int i = 0; i < 2; i++) {
this.step(size);
this.turn(90);
}
this.closePolygon();
}
public void house(double size) {
double x, y;
x = this.getX();
y = this.getY();
// this.square(size);
// this.step(size);
// this.turn(30);
// this.triangle(size);
// this.turn(-30);
// this.step(-size);
this.square(size);
this.step(size);
this.turn(30);
this.triangle(size);
this.turn(-30);
this.setPosition(x, y);
}
public void filledHouse(double size) {
this.openPolygon();
this.house(size);
this.closePolygon();
}
}