Skip to content
greg737 edited this page Aug 28, 2015 · 1 revision

#Animals

animal

Animals are another form of dynamic entity that inherits attributes from the Entity super class. It is modelled after a dog.

Similar to the Visitor class, it is difficult to accurately predict the behaviour of the Animal. Thus it was decided that the Animal will have behaviour of randomly navigating around the orchard. Though as it is modelled after a dog, it will occasionally try to follow a Visitor around the orchard as well.

##go_to_rand_location()

The behaviour of this function is exactly the same as the one found in the Visitor class.

#go_to_visitor()

When choosing what action to do next, there is a 50% chance that the next action will be attempting to follow the visitor around. When this action is chosen, it will be appended to the action stack 10 times, essentially meaning that the next 10 actions will be attempts to follow the visitor. The way this method works is by first subscribing to positional messages published by the Visitor class.

animal

It stores this information in a dictionary of Visitor positions. The method then selects any of the Visitor position values, and creates the necessary goto actions to navigate to the last known position of the visitor.

Clone this wiki locally