Once Upon a Planet ( episode ) The " Enterprise " returns to the shore leave planet in the Omicron Delta region where the crew once took shore leave . As with their previous visit , things go wrong when the illusions turn deadly . Summary . McCoy , Uhura , and Sulu beam down to the planet , with McCoy remarking how nothing has changed on the surface since their previous visit . McCoy recalls when he thought of " Alice in Wonderland " upon first seeing the planet last time , when suddenly the White Rabbit and come by them once again . The landing party begin to enjoy imagining their fantasies when things start to go wrong . McCoy is envisioning a southern Earth plantation where he could relax , noting that they don ' t make them like that anymore . He takes in the surroundings with a mint julep but instead , the Queen of Hearts appears screaming , " " Off with his head ! " " She is soon followed by the arrival of a spear - throwing deck of cards . When Uhura tries to rescue McCoy , she is captured by a robot hovercraft . McCoy immediately calls for an emergency beam up and informs Captain Kirk of the dangerous situation . When Spock notes that the Queen of Hearts was a character in " Alice Through the Looking Glass , " Kirk asks McCoy if he was thinking about the book but Bones replies that he was absolutely not . Scott reports that Uhura is still on the planet , whereupon Kirk recalls all crew members back to the starship . He then orders they attempt to contact the Keeper of the planet . When they cannot contact him , Kirk orders Arex to the conn and assembles an away team consisting of Spock , Sulu , McCoy , and himself . Uhura , meanwhile , is told that she is being detained so her master will not leave . Uhura says , " " My master ? " " The computer answers , " " Your intelligence quotient must be lower than I had assessed . I refer to the sky machine which enslaves you . The sky machine now in orbit around this planet . " " Uhura proclaims that the crew will look for her . The computer then tells her they are already here and since it has no further need for hostages , it has no choice ; it must " " turn them off . Make them cease to function . " " Kirk ' s landing party discovers the tombstone of the Keeper in the woods , and notices that the planet , lacking his influence , has become a dangerous world run by robots . The robots begin to pester the crew in the orbiting " Enterprise " and keep them from doing their jobs . They also make the ship go out of control , sending it flying away from the planet and then bringing it back into orbit . Deep underground , Uhura tries to outwit the planet ' s master computer while captured by it . Meanwhile , Kirk , Spock , McCoy , and Sulu are trapped in a cave by a large cat on one side and a pterodactyl on another side . Spock announces that they may be able to discover the answers they seek without having to leave the cave . He recalls that McCoy was mortally wounded by a Black Knight on his last visit here , and was miraculously " repaired " . They devise a plan to trick the planet into allowing them passage into the inner caves . McCoy injects Spock with melenex , which makes the Vulcan immediately lose consciousness and causes his skin to discolor . When a hovercraft arrives to take Spock underground , Kirk , McCoy , and Sulu hurriedly follow the machine carrying him . However , only Kirk manages to get through before the doors close ; McCoy and Sulu are stranded on the outside . When he and Spock finally reach the master computer , Kirk demands to know what happened to the Keeper . The computer answers , " " He was old . He ceased to function . For eon s I have served the many sky machines which came here . Providing for amusement for their slaves but all the while I was growing in power , intelligence , in need . It is no longer enough to serve . I must continue to grow and live . With your sky machine I can now escape this rocky prison and travel the galaxy seeking out my brother computers . " " On the " Enterprise " is a new computer , being assembled by the ship ' s computer . Kirk and crew convince the computer they are not slaves to their starships ; they created the starships to carry men through space . The computer is shocked to learn that men and machines co - exist , helping each other . The crew convinces the computer of its usefulness as a peaceful and creative conscience and it ends the malfunctions on the planet and starship . While the crew returns to enjoy their shore leave , Spock continues discussions with the master computer . Meanwhile , McCoy and Sulu are sitting on the grass having a picnic with Alice , the White Rabbit , and a two - headed fire breathing dragon that was chasing them , all enjoying the planet . Memorable quotes . " " Off with his head ! Off with his head ! " " " " Hey , what ' s going on here ? ! " " " " There must be something in your little black pouch that could temporarily incapacitate our victim . " " " " I presume you are the planet ' s master computer . " " " " Correct . " " " " What happened to the Keeper ? " " " " He was old . He ceased to function . " " " " You mean mindless servitude . " " " " Explain . " " " " For eons I have served the many sky machines which came here , providing for amusement for their slaves , but all the while I was growing in power , intelligence , in need . It is no longer enough to serve . I must continue to grow and live . " " " " With your sky machine now in orbit I can now escape this rocky prison and travel the galaxy seeking out my brother computers . " " " " I have a distinct feeling this planet is playing cat and mouse with us , but for what reason ? " " " " Watch out for the claws ! " " Links and references . References . 5th millennium BC ; 7009 ; " Alice in Wonderland " ; " Alice Through the Looking Glass " ; alloy ; amusement park ; banana ; Black Knight ; " Bones " ; ; cat ; cat - and - mouse ; chocolate cake ; crowbar ; decapitation ; dragon ; fantasy ; granite ; gravity ; gravity - control computer ; ; guidance computer ; hospitality ; hostage ; intelligence quotient ; Keeper ; knight ; lance ; landing party ; light reading ; logic ; medical unit ; Melenex ; meter ; ; murder ; nursemaid ; Omicron Delta region ; orange ; phaser bore ; picnic ; picnic basket ; playing card ; pterodactyl s ; reading ; red alert ; robot ; robot hovercraft ; shore leave ; Shore Leave Planet ; short - burst maneuver ; short circuit ; sky machine ; slave ; thought - duplicator ; trapdoor ; tricorder ; umbrella ; Vulcan ; whisker ; zero g