Create a class LifeBug that is a kind of Bug. LifeBug has the following properties:
- A LifeBug only understands angles that are multiples of 90 degrees. A LifeBug will never be at any of the 45-degree angles.
- Adjacent squares are defined as vertical and horizontal but NOT diagonal.
- A LifeBug can move to any adjacent square that is open except for the one behind it. In other words, if the LifeBug is facing to the right, it cannot move left, but it could move up, right, or down.
- If a LifeBug cannot move because all of its neighbors are occupied, it simply sits for that iteration.
- After a LifeBug moves, it points in the direction of its movement. For example, if it moves up, it should point upward after movement.
- It does not matter if a LifeBug leaves or eats flowers. You can decide what to do about flowers.
- A LifeBug has a chance of breeding every time it acts. Call this probBreed. If it breeds, then the adjacent squares that are empty or contain a flower in all four directions are populated with LifeBug of its same color.
- If a LifeBug breeds, then it cannot move for that turn. Neither do its offspring.
- A LifeBug has a chance of dying every time it acts. The probability of that should be called probDeath. A LifeBug that dies simply ceases to be on the grid. You can decide whether or not to move the LifeBug before checking for dying.
Create a LifeBug class with probBreed = 1 in 7 and probDeath = 1 in 5.