In this problem you will navigate Clara to her precious leaf while avoiding the trees that block Clara’s way. You will start with the world presented in Figure 1 and will have to produce the result shown in Figure 2. The dotted line shown in Figure 2. represents the trajectory of Clara’s movement, so make sure that Clara moves exactly like shown there. After navigating her way around the trees Clara must eat the leaf, make one step forward and then stop.

University/Course: WSU

Uploaded: November 2, 2024

Files: 1

✓ Solution:

/* PERMITTED COMMANDS
   move(); turnLeft(); putLeaf(); removeLeaf();
*/
class MyClara extends Clara { 
/**
     * In the ‘run()’ method you can write your program for Clara 
     */
void run() {
// TODO: Write your code below
    move();
    turnLeft();
    turnLeft();
    turnLeft();
    move();
    turnLeft();
    move();
    move();
    turnLeft();

🔒 Whatsapp us for the full file.