I learned programming by reading the source code of this game in the fantastic book by David Ahl. I still remember an array called K which contained the X,Y coordinates and shield strength of each Klingon warship.
http://www.amazon.com/BASIC-Computer-Games-Microcomputer-Dav...