has set course for the "shove leave" planet for R&R. The planet's sole purpose is to provide amusement for space travelers, manifesting bio-constructs based on their thoughts and imagination. McCoy, Uhura, and Sulu are among the first to beam down and Sulu remembers when they saw the White Rabbit on their previous visit. The planet immediately manifests a White Rabbit and Alice running by. They separate and Uhura enjoys herself by a lake. McCoy finds himself at a Southern-style manor when suddenly the Queen of Hearts and two soldier playing cards attack him. He runs for it and calls for transport up to the ship. Uhura overhears the transmission and checks in, but a robot appears and takes away her communicator.
Back on the ship, McCoy explains what happened and is sure that he wasn't thinking of Alice in Wonderland
when he was attacked. Sulu didn't experience anything unusual. Scotty reports that he lost contact with Uhura and Kirk has him beam up the other landing parties. Spock is unable to locate Uhura and no one saw the Keeper, the individual who monitors the planetary computer and makes sure no one gets hurt. They know his quarters are underground near the primary computer, but the planet is shielded against sensor scans. Kirk beams down with Spock, Sulu, and McCoy to investigate.
Uhura is underground and the primary computer informs her that she's being detained so her "master," the "sky machine," won't leave. Uhura doesn't know what it's talking about and it explains that the sky machine in orbit enslaves it. Uhura demands her immediate release and warns her crewmates will look for her. The computer informs her that they're already there, but it has no use for more hostages so it will "turn them off."
Spock scans the planet and determines the planet has an underlying metal shell. Kirk calls the ship for a phaser bore but is cut off by interference. Scotty attempts to beam down the phaser bore but the transporter refuses to function. Sulu spots an obelisk. Investigating, they find it's a tombstone for the Keeper, who has passed away. In orbit, Scotty attempts to send down a shuttlecraft but the hangar doors refuse to open. Below the surface, Uhura tries to convince the computer not to harm her crewmates. She spots a power circuit and tries to sabotage it but the computer reads her mind and stops her before she can do anything. It speaks less than enthusiastically about its life of service and says that it is time for a change.
The landing party tries to request the computer to provide them with one of the passageways to the underground facility without success. McCoy snaps, wondering if they're expecting signs, and a sign appears directing them to an underground entrance. They have no choice but to follow the signs, which appear ahead of them and disappear behind. The trail leads to a valley where pterodactyls appear despite the fact none of them were thinking of such a thing. They try to retreat but the pterodactyls attack. The landing party discovers their phasers don't work and run for a nearby cave. They get inside just in time and Kirk wonders why the computer is playing a cat-and-mouse game with them. Immediately a giant cat appears and tries to get at them without success. Spock advises them to guard their thoughts. The computer monitors them and Uhura asks it to stop but it informs her it has work to do. In orbit, the Enterprise
suddenly leaves orbit and Lt. Arex is only just able to regain control using manual override. The log shows a new series of short-burst maneuvers fed through the computer, maneuvers that constitute a system checkout. Scotty concludes the planet computer is trying to learn how to control the ship.
The cat disappears but Spock suggests they stay in the cave and try to reason out the problem. He questions McCoy about the fact that when he was mortally wounded on their last visit, he was taken underground for medical treatment. They assume the planet will automatically try to tend to any injured person. McCoy comes up with an injection that will simulate illness and Spock argues that he's the most qualified subject. Kirk orders them to go ahead and McCoy injects Spock, warns the effect will last for ten minutes and he gets outside before collapsing.
Aboard the Enterprise
, the artificial gravity cuts out and they can't get to the computer.
A robot emerges from a hidden panel and picks Spock up. It retreats and the landing party tries to follow but only Kirk gets through before the panel closes. A two-headed fire-breathing dragon appears to threaten McCoy and Sulu while inside, Kirk follows the robot. It sets down Spock, who recovers consciousness and moves through the complex. He finds Kirk, but they're unaware the planetary computer is watching them.
Sulu and McCoy head for some nearby rocks while inside, Kirk and Spock find the computer. The computer informs them the Keeper ceased to function and Kirk asks for an explanation. The computer explains that it grew in power and intelligence as it served those who visited the planet. It wants to grow and plans to use the "sky machine" to escape the planet and seek out its brother computers.
Scotty and Gabler manage to get to the ship's computer core, only to discover it's building a new computer. When Scotty tries to get to it, he's repelled by a force field. Below, Sulu and McCoy are trapped in a dead end as the dragon closes in.
Kirk and Spock explain that they created the "sky machine" and they live in a co-existing relationship. Uhura suggests that it should talent its gift to help others, and Spock suggests it could learn more by offering wonders to the galaxy so they'll come to it and share information. The computer agrees to their proposal and releases the Enterprise
, then recalls the dragon. It invites the crew to be their guests but asks that someone have more discussions with it. Spock is glad to participate and Kirk contacts the ship to tell them to recommence shore leave. Spock notes that Sulu and McCoy are already enjoying shore leave, as they participate in a picnic with the dragon, Alice, and the White Rabbit.