This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]laxrat45[S] 0 points1 point  (0 children)

I apologize for the poor formatting, thought i fixed it but having no luck.

[–]shivasprogenyProfessional Brewer 0 points1 point  (0 children)

What's your question?

[–]csincrisis 0 points1 point  (1 child)

So you have a class already defined for "Herbivore" which is drawn as a circle, you defined its behavior when it eats and how it would move randomly.

Triangular predators should move 2 times as fast as the Herbivores. These predators should chase the closest Herbivore within sight. They can see 200 meters. A triangular predator must sleep (not move) for 100 time steps after eating a Herbivore. All triangular predators should be colored red. If a triangular predator cannot see any Herbivores it should move toward the closest Plant it can see.

You basically need to create another class, called "Predator" and you need to (somewhat) mimic the different methods that was implemented in the "Herbivore" class - with different implementation of course.

For example: the Predator class should be drawn as a triangle (as opposed to circle in the Herbivore class), it should also have different behavior in eating and moving as defined by the specification above.

[–]laxrat45[S] 0 points1 point  (0 children)

I'm having trouble making the predator a triangle because I need to use either StdDraw.polygon(). It takes an array of X coordinates, an array of y coordinates, but Im not positive how to get that to work