Hello world!

When I hear “Hello, world,” the first thing I think of is…

class Turtle : Robot
{
	void turnAround();
	void turnRight();
	void move2();
	void put1();
	void put2();
	void put5();
};

void Turtle :: turnAround()
{
	turnLeft();
	turnLeft();
}

void Turtle :: turnRight()
{
	turnAround();
	turnLeft();
}

void Turtle :: move2()
{
	move();
	move();
}

void Turtle :: put1()
{
	move();
	putBeeper();
}

void Turtle :: put2()
{
	put1();
	put1();
}

void Turtle :: put5()
{
	putBeeper();
	loop (4)
	{
		put1();
	}
}

task
{
	Turtle Karel(2,2,North,55);

	Karel.put5();
	Karel.turnAround();
	Karel.move2();
	Karel.turnLeft();
	Karel.put2();
	Karel.move();
	Karel.turnLeft();
	Karel.move2();
	Karel.turnAround();
	Karel.put5();
	Karel.turnLeft();
	Karel.move2();
	Karel.turnLeft();
	Karel.put5();
	Karel.turnRight();
	Karel.put2();
	Karel.turnRight();
	Karel.move2();
	Karel.turnRight();
	Karel.putBeeper();
	Karel.put1();
	Karel.turnLeft();
	Karel.move2();
	Karel.turnLeft();
	Karel.putBeeper();
 	Karel.put1();

	loop(2)
	{
		Karel.move2();
		Karel.turnLeft();
		Karel.put5();
		Karel.turnAround();
		Karel.move2();
		Karel.move2();
		Karel.turnLeft();
		Karel.put2();
	}

	Karel.move2();

	loop(2)
	{
		Karel.put2();
		Karel.move();
		Karel.turnLeft();
		Karel.put5();
		Karel.turnLeft();
	}

	Karel.move2();
	Karel.move2();
	Karel.put1();
	Karel.turnLeft();
	Karel.move();
	Karel.put2();
	Karel.put1();

	Karel.turnOff();
}
	
	Turtle.turnOff();
}

…Karel!

No, Lunchbox, Karel J. Robot is not food.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s