Star Trek: The Ultimate Computer

On stardate 4729.4, the Enterprise is summoned to a space station without explanation. The station commander, Commodore Wesley, explains that the Enterprise will be a test vessel for a revolutionary tactical computer called the "M5 Multitronic System", designed by the brilliant Dr. Richard Daystrom. The M5 will handle all ship functions without human assistance. While Kirk and Dr. McCoy are unhappy about the test, Mr. Spock is impressed with M5. Kirk learns that four earlier prototypes were unsuccessful, giving him further doubts.

At first M5 works well, performing ship functions more quickly and efficiently than a living crew. Later, M5 exhibits quirks such as turning off power and life support to unoccupied parts of the ship. It draws increased power for unknown reasons. Daystrom maintains M5 is working properly.

In a drill, M5 defends the Enterprise against mock attacks from starships USS Excalibur and USS Lexington. The Enterprise is declared the victor, prompting the Lexington's commander to call Kirk "Captain Dunsel". Spock explains the term is used by midshipmen at Starfleet Academy to describe a part serving no useful purpose.

Soon after, M5 detects an unmanned freighter that is not part of the test, and attacks with real weapons, destroying it. Kirk orders M5 taken offline, but Daystrom continues to believe M5 is working correctly, and refuses. Kirk tries to disconnect M5, but discovers it is protecting itself with a force field. Engineer Montgomery Scott assigns a technician to unplug the main connection, but the crewman is killed in the process. Spock and Scott desperately attempt a manual override, but they discover M5 has bypassed its power source and now draws energy directly from the ship's warp engines. Daystrom persistently defends M5 and refuses to disconnect it.

Spock questions Daystrom on his computer design. Daystrom reveals he has programmed human engrams into M5. Pressed further, Daystrom admits the engrams he used were his own, meaning M5 thinks similarly to Daystrom himself. With increased stress and anger, Daystrom appears unstable. M5 now shows similar instability. An attempt by the Enterprise crew to isolate M5 from the ship fails, as they are duped by a decoy M5.

Meanwhile the other ships in the test continue unaware of the problems with the Enterprise. Next follows a wargame against four Federation starships. M5 detects the ships, but does not treat them as part of the trial, firing on them with live weapons. Daystrom states the M5 is programmed to preserve itself by any means. Although surprised by M5's actions, Daystrom simply views them as mistakes made by a learning "child". An angry Kirk asserts these "mistakes" are costing lives, and the computer must be shut down.

The crew watches as M5 pounds the other ships relentlessly. The Enterprise fires on the Lexington, killing 53, then destroys the Excalibur. From the Lexington, Commodore Wesley orders the remaining ships to destroy the Enterprise at all cost. Since M5 has disabled communications, Kirk is unable to explain what is happening. Kirk demands that Daystrom act, but the scientist will not accept M5 as another failure. He rambles about proving his worth and curses colleagues taking credit for his work. McCoy sees a psychotic episode coming, and warns Kirk the scientist is becoming delusional.

Kirk has Daystrom taken to sickbay after Spock fells him with a Vulcan nerve pinch. He then talks to M5 to see whether he can persuade it to stop the attacks. The M5 acknowledges Kirk, who asks M5 what its purpose is. M5 responds "To save men from the dangerous activities of space exploration." Kirk rejoins that it just acted contrary to its purpose by killing people. M5 recognizes the penalty for murder is death, so it shuts itself down. In so doing, it cripples the Enterprise, setting the ship adrift.

The other Federation ships now close on the Enterprise to destroy it. While Scotty frantically attempts to regain control of the ship, Kirk decides to let the ship drift with shields down, hoping that Commodore Wesley guesses the situation. The gamble pays off as the Commodore orders his ships to stand down at the last moment.

McCoy says that Daystrom will be committed to a rehabilitation center. Kirk explains that he knew that Wesley would not fire, because he is compassionate. McCoy makes the pointed comment that compassion is something computers lack. Spock responds that machines are more efficient than living beings, but not better. Then he dryly remarks that McCoy's engrams in a computer would be most entertaining.