Hey guys, ultra stuck on this uni problem.
So I'll post the question, available commands and the code:
tldr
Need to guide the beetle (Clara) through the maze until she finds the leaf. Once on the leaf, Clara needs to eat the leaf and stop.
The code needs to be generic enough to work in any maze scenario.
From memory, there's a stop(); command. If such command is not needed, then don't worry about it.
*removed*
If that doesn't work, here is MyClara.java:
If anything is unclear, please ask.
Thanks.
Edit: Download link: http://wikisend.com/download/217686/P3_code(5).zip
So I'll post the question, available commands and the code:
tldr
Need to guide the beetle (Clara) through the maze until she finds the leaf. Once on the leaf, Clara needs to eat the leaf and stop.
The code needs to be generic enough to work in any maze scenario.
From memory, there's a stop(); command. If such command is not needed, then don't worry about it.
*removed*
If that doesn't work, here is MyClara.java:
Code:
/**
* MyClara is a subclass of Clara. Therefore, it inherits all methods of Clara: <p>
*
* PERMITTED COMMANDS
* Actions: move(), turnLeft(), turnRight(), putLeaf(), removeLeaf()
* Sensors: onLeaf(), treeFront()
* JAVA: if, else, while, for, !, &&, ||
*/
public class MyClara extends Clara
{
/**
* In the 'run()' method you can write your program for Clara <br>
*/
public void run()
{
// TODO: Write your code below
}
}
If anything is unclear, please ask.
Thanks.
Edit: Download link: http://wikisend.com/download/217686/P3_code(5).zip

























