CSC490: Homework 3


This homework is the first AI homework in the course. It uses your HW2 code.

Add a Finite State Machine (FSM) to your Asteroids code that controls the ship. The FSM will be very simple, having only four states: Approach, Attack, Idle, and Evade. The state transitions are as follows:

You have to code the state transition conditions and the states themselves. Every state does something different from the rest, and has quite a bit of code (e.g., a ship in the "Approach" state will locate the nearest asteroid and try to get it in range by applying the proper thrusts and rotations, etc).

For the range, use a sensible number (e.g., half the screen). The ship's bullets are ineffective if they go beyond that.