This was also the first computer game I ever played! It was on an HP 2000 computer running timeshared BASIC from a clunky teletype, in the early 1970s. The best part was that you could just type "LIST" and it would print out all the BASIC code - all the games on that machine were open source!
If the Klingons beat you, you'd get this disheartening message, which I remember to this day: "The Enterprise has been destroyed. The Federation will be conquered. You are dead."
I also remember playing a car racing game on the same machine, and also a game about landing a spaceship on the moon (which, a few years later, I created a real-time version of on a 6800 microprocessor in machine language). But the Star Trek game was definitely the best one.