Can you find three errors in this code?
In this example, the student is trying to create 100 grass agents and 10 turtle agents and scatter them randomly around Spaceland. The rabbits are to hop around. The rabbit agents are suppose to gain 1 energy after colliding with a grass and the grass is supposed to be deleted. If a rabbit loses all its energy, it should be deleted.
Here's the student's code:
Please put your answers in the comment box below.
ANSWERS (We didn't get to review this one on the webinar)
On rabbit page
1. Incorrectly incrementing the value of a trait. Should be: "set my Rabbit Energy to my Rabbit Energy +1"
2. Deleting the wrong agent in collision block. The current code has the rabbit deleting itself instead of the grass being deleted.
3. Forgetting to call a procedure to use it after specifying the code.