package lessons.welcome.methods.picture;

import java.awt.Color;
import plm.universe.bugglequest.SimpleBuggle

class ScalaMethodsPictureEntity extends SimpleBuggle {

	/* BEGIN TEMPLATE */
	override def run() {
		/* BEGIN SOLUTION */
		for (i <- 1 to 3) {
			makeLine(3);
			nextLine();
		}
	}
	def mark() {
		brushDown();
		brushUp();
	}

	def makeV(c:Color) {
		setBrushColor(c);
		forward();
		mark();

		forward();
		left();
		forward();
		mark();

		backward();
		right();
		forward();
		mark();

		forward();
		left();
	}

	def makePattern() {
		makeV(Color.YELLOW);
		makeV(Color.RED);
		makeV(Color.BLUE);
		makeV(Color.GREEN);
		forward(5);
	}

	def makeLine(count: Int){
		for (i <- 1 to count)
			makePattern();
		backward(count*5);
	}

	def nextLine() {
		left();
		forward(5);
		right();	
		/* END SOLUTION */
	}
	/* END TEMPLATE */
}
