This was created for an assignment in my 3rd year of university. The application was created in Unity and the Fuzzy-Logic Sharp library created by David Grupp. The goal being to move a box object towards a goal object and avoid/move around an obstacle. Randomly repositioning the goal and obstacle objects once the agent has reached the goal. Then resetting the box object to the centre then letting it repeat for an allotted time. The application will also calculate a score for each session of the application.Reaching the goal object will add points and colliding with the obstacle will subtract points. Along with this it will count the number of times the box collided with the obstacle and the average time it took for the box to reach the goal.
This was achieved through the use of Fuzzy logic. Utilising its ability to deal in non-absolutes and ambiguous values which would be used to determine how much the object would have to move to reach its destination. With similar logic to avoid the obstacle.
Direction & Distance Logic
The graph above represents the logic of the box movig closer to the target. As the box would aim towards remaining at zero distance to the goal.
Avoidance Logic
The graph above represents the logic of the box avoiding an obstacle.
The above code descibes the rules for the Goal engine.
The above code descibes the rules for the Obstacle avoidance engine.