This homework is an upgrade to both HW2 and HW3. It requires you to make small changes to the ship in HW2, and large changes to the FSM in HW3.
Change the ship (or add a new one) to become a saucer. The saucer does not require turning to thrust. It flies with antigravity, and thus doesn't suffer from inertia or slow acceleration. This means that you can input velocity vectors directly on the saucer, and its velocity is instantly replaced by the new one. The saucer also has a gun turret that can fire in any direction, independent of the direction of its motion.
The saucer is a good candidate for a Fuzzy State Machine (FuSM) because its main systems, movement and attacking, are decoupled. Given some basic perceptions, each system can operate independently and concurrently. Thus, the saucer will no longer use a state system to progress from one state to another, but will rather have multiple independent activities contributing to the overall behavior of the ship.
After you implement the saucer (if your hw2 code is good, this entails removing some code and adding a couple of lines), add a FuSM to control it with the following basic states:
The main bit of data that you'll need to calculate each state's activation level (its fuzzy truth value) is the distance to the nearest asteroid. The closer the asteroid is, the more the craft will evade and attack; the further away, the greater the activation of the approach behavior.
If you have time, you can try combining this FuSM with a suitable FSM (e.g., for the evade state). HW4 is turning out to be very light in terms of coding (assuming that you did hw2 and hw3 correctly), and you can use the remaining time to adjust various parameters in preparation for the competition. For example, can you think of a good FuSM for the regular ship?
Here is the code from class for FuSMs.