Untitled

mail@pastecode.io avatar
unknown
java
a year ago
4.3 kB
7
Indexable
Never
import org.code.neighborhood.*;

public class BeePainter {

  MuralPainter muralPainter = new MuralPainter();
  
  public void paintBee() {
    muralPainter.paintBackground("ivory", 14);

    paintBody();
    paintAntennae();
    paintWings();

    muralPainter.moveToCorner();
  }

  private void paintBody() {
    getToStartOfBody();
    for(int i = 0; i < 3; i ++) {
      muralPainter.paintLine("black", 4);
      muralPainter.turnToWest();
      muralPainter.paintLine("yellow", 6);
      muralPainter.turnToEast();
      muralPainter.move(2);
    }
    muralPainter.paintLine("black", 4);
    muralPainter.turnToWest();
    muralPainter.move(2);
    muralPainter.paintLine("black", 2);
  }

  private void paintAntennae() {
    getToStartOfRightAntenna();
    paintRightAntenna();
    getToStartOfLeftAntenna();
    paintLeftAntenna();
  }

  private void paintRightAntenna() {
    muralPainter.paintLine("black", 1);
    muralPainter.turnLeft();
    muralPainter.move();
    muralPainter.paintLine("black", 1);
    muralPainter.turnRight();
    muralPainter.move();
    muralPainter.paintLine("black", 1);
  }

  private void paintLeftAntenna() {
    muralPainter.paintLine("black", 1);
    muralPainter.turnRight();
    muralPainter.move();
    muralPainter.paintLine("black", 1);
    muralPainter.turnLeft();
    muralPainter.move();
    muralPainter.paintLine("black", 1);
  }

  private void paintWings() {
    getToStartOfTopLeftWing();
    paintTopLeftWing();
    getToStartOfTopRightWing();
    paintTopRightWing();
    getToStartOfBottomRightWing();
    paintBottomRightWing();
    getToStartOfBottomLeftWing();
    paintBottomLeftWing();
  }

  private void paintTopLeftWing() {
    muralPainter.paintLine("silver", 2);
    muralPainter.turnToWest();
    muralPainter.paintLine("silver", 3);
    muralPainter.turnToEast();
    muralPainter.move();
    muralPainter.paintLine("silver", 3);
    muralPainter.turnToWest();
    muralPainter.paintLine("silver", 4);
    muralPainter.turnToEast();
    muralPainter.move(2);
    muralPainter.paintLine("silver", 3);
  }

  private void paintTopRightWing() {
    muralPainter.paintLine("silver", 2);
    muralPainter.turnToWest();
    muralPainter.move();
    muralPainter.paintLine("silver", 3);
    muralPainter.turnToEast();
    muralPainter.move();
    muralPainter.paintLine("silver", 3);
    muralPainter.turnToWest();
    muralPainter.move();
    muralPainter.paintLine("silver", 4);
    muralPainter.turnToEast();
    muralPainter.move();
    muralPainter.paintLine("silver", 3);
  }

  private void paintBottomRightWing() {
    muralPainter.paintLine("silver", 3);
    muralPainter.turnToEast();
    muralPainter.move(2);
    muralPainter.paintLine("silver", 3);
    muralPainter.turnToWest();
    muralPainter.move(2);
    muralPainter.paintLine("silver", 2);
  }
  
  private void paintBottomLeftWing() {
    muralPainter.paintLine("silver", 3);
    muralPainter.move();
    muralPainter.turnToEast();
    muralPainter.move();
    muralPainter.paintLine("silver", 3);
    muralPainter.turnToWest();
    muralPainter.move();
    muralPainter.paintLine("silver", 2);
  }

  private void getToStartOfBody(){
    muralPainter.turnRight();
    muralPainter.move(8);
    muralPainter.turnRight();
    muralPainter.move(9);
    muralPainter.turnRight();
  }

  private void getToStartOfRightAntenna() {
    muralPainter.turnRight();
    muralPainter.move(8);
    muralPainter.turnRight();
    muralPainter.move(2);
  }

  private void getToStartOfLeftAntenna() {
    muralPainter.turnAround();
    muralPainter.move(4);
    muralPainter.turnLeft();
    muralPainter.move(2);
    muralPainter.turnRight();
  }

  private void getToStartOfTopLeftWing() {
    muralPainter.move(2);
    muralPainter.turnLeft();
    muralPainter.move();
    muralPainter.turnLeft();
  }

  private void getToStartOfTopRightWing() {
    muralPainter.move(6);
    muralPainter.turnLeft();
    muralPainter.move(4);
    muralPainter.turnRight();
  }

  private void getToStartOfBottomRightWing() {
    muralPainter.turnRight();
    muralPainter.move(2);
    muralPainter.turnRight();
    muralPainter.move();
  }

  private void getToStartOfBottomLeftWing() {
    muralPainter.move(5);
    muralPainter.turnRight();
    muralPainter.move(2);
    muralPainter.turnLeft();
  }
}