Finite State Machine
The virtual battleground is developed by the course instructor. I programmed each state using if statements and math calculations to determine whether there is an incoming danger. Then corresponding action will be performed such as dodging bullets or shooting. Traps in the map are also considered.