In the third chapter, the book suggests some improvements to the Hide Algorithm, and my approach implements the next considerations.
- The prey tries to hide when the hunter is in the prey's vision radius (gray circumference) and the prey is in the hunter's vision radius (blue circumference)
- Whether the hunter is not in the vision radius, the prey tries to hide if the last time when the hunter was seen within the elapsed N seconds (N is an initial parameter)
- The possible hiding spots (dark green dots) will be which are on the side or in the back of the hunter. The front area covers 30 degrees on the left side of the hunter's head and 30 degrees on the right side of the same. (60 degrees in total)
If you are curious about the code that helped to implement the improvements, here is the list of the functions
You can watch it in action, just hit the link
