markcornwell / spacewar

Javascript implementation of 1962 game Spacewar! originally developed for the PDP-1
MIT License
0 stars 0 forks source link

provide an AI for single payer mode #5

Open markcornwell opened 4 years ago

markcornwell commented 4 years ago

Need to be able to play a 2nd payer, the computer AI, for solo gamming.

markcornwell commented 4 years ago

AI for 1 Player. Follow an OODA procedure.

In single player -- illustrative example

  1. Observe: Is opponent player still in game? Yes. Where is opponent? Is opponent in range?
  2. Orient: Where is opponent? Which way, how far? What is fastest way to rotate toward opponent?
  3. Decide: We need to rotate and move closer.
  4. Act: Rotate toward the player's ship, fire thruster briefly to get to target speed, when in range pointed at target will fire missiles. Will then repeat this observe, orient, decide, act loop.