The Practical Joker (episode)
After passing through a strange space energy cloud, the Enterprises computer gains an artificial intelligence that is relentlessly bent on making practical jokes on the crew.

Summary
"Captain's log, stardate 3183.3. Our present mission: a routine geological survey of type 4 asteroids is nearing completion. The cruise has been uneventful and we are now approaching the final asteroid in our assigned sector a full 72 hours ahead of schedule."

The  is soon attacked and damaged by three Romulan vessels lying in wait on the far side of the asteroid. Montgomery Scott wants to fight but since they are outnumbered and their shields are unable to withstand another attack Captain Kirk thinks that discretion is the better part of valor. When Uhura establishes contact, the Romulan commander claims the Federation vessel had trespassed into Romulan space in defiance of their own treaty. Kirk claims they did no such thing and he will file a detailed report with the Federation. The Romulan tells Kirk that the punishment for such a transgression is death. Kirk leaves and the Romulans go after him. Sulu reports an unidentified energy field has appeared in their path and the captain thinks it is just the thing to shake the Romulans. He then orders the crew to batten down, they are going through.

The Enterprise manages to shake the Romulans, but unknown to the crew, a cloud enters the Enterprises computer systems. They leave, and Scott gets to work repairing the damaged systems. As the crew toasts their narrow escape, their glasses leak, and Dr. McCoy comments that they have a practical joker in their midst. Then, during the dinner, Kirk's silverware bends. Spock is embarrassed when a new microscope that has suddenly appeared at his science station leaves black rings around his eyes, Scott is pelted with fruits and pies from a food synthesizer, much to the amusement of Arex and M'Ress, and Kirk discovers a message on the back of one of his clean uniforms that reads "Kirk is a jerk."

"Captain's log, supplemental. Unusual incidents continue to plague our crew. Even our perceptive Mr. Spock has fallen victim to these simple-minded pranks. As these little surprises have grown more and more frequent our crewmembers have found them less and less amusing. The situation has reached the point where friends are accusing friends; the entire crew is on edge, myself included."

The situation puts the entire crew on edge. They discover the source of the jokes when outrageous laughter is heard over the ship's intercom. Spock pinpoints the source as the Enterprise itself. Kirk orders all hands to their stations to get to the bottom it. M'Ress reports that Sulu, McCoy, and Uhura are inside a recreation room and do not answer the call to station. The three officers however, don't hear the call. Kirk realizes that the three crewmembers have been trapped and orders Scott to shut down the computer's logic circuits. Kirk then orders the computer to release the trapped officers and is shocked when it tells Kirk to say "Please." Scott meanwhile, is unable to shut down the logic circuits because the gravity has been shut off. Spock thinks if Scott backs off, the computer will feel less threatened and it works. Spock figures out that the subatomic particles from the energy field have invaded the computer circuits much the same way bacteria infect living matter. As a result, the Enterprise is having the electronic equivalent of a nervous breakdown. In the recreation room, the three officers are subjected to a snow storm and are freezing to death. Soon the bridge's air is replaced by laughing gas, which causes pain to Vulcans.

"Captain's log, supplemental. Somehow Spock managed to switch on our emergency air before collapsing from the effects of the gas. The fresh air quickly revived us, although it will be exhausted within another six hours. We must cure our computer by then or there is no telling what we will be forced to breathe next."

The ship finally releases McCoy and the others from the recreation room and Kirk lets them know how good it is to have them back, alive and well. Sulu reports that the navigation controls are not responding but they are coming about to a new heading, right into the Neutral Zone. This provokes another Romulan attack on the Enterprise. The ship then plays a practical joke on the Romulans by creating a giant balloon shaped like the Enterprise out from the shuttlebay and tricks them into firing on it, knowing they fear disgrace more than death. The Enterprise escapes, but the furious Romulans give chase. Kirk appears to be very concerned about passing through the same energy field they previously encountered, and cries out in terror when the ship changes course to do so. This is all a ruse, however; Kirk has guessed that another pass through the cloud might reverse the effect on the ship's computer, and was only pretending to be afraid. The computer is returned to normal, after a final statement from the Practical Joker: "You tricked me Kirk. How could you?" Spock reports that all effects have been reversed. Uhura reports strange transmissions from the Romulan warships, which followed them through the field. It seems they are beginning to be affected by the same symptoms as Kirk's crew was. McCoy asks, "Should we tell them how they can reverse the effects of the field, Jim?" Kirk says, "Yes, but later. Let's not spoil their fun just yet," and everyone on the bridge gets a good laugh.

Log entries 
 Captain's log, USS Enterprise (NCC-1701), 2270

Memorable quotes
"A cold-blooded ambush! Let's give the heathens a fight they won't soon forget!"
 - Scott, upon learning of the Romulan attackers

"Go ahead and laugh! Big joke! I'll bet you two are responsible for this, eh?"
"Hey, wait a minute! We didn't cause this to happen!"
"Tell that to the captain! I'm reporting the both of you just as soon as I...!"
 - Scott and Arex, the last line interrupted by a pie in the face

"Captain, crewmembers McCoy, Sulu, and Uhura are still in the recreation room and do not answer the call to stations."
 - Lieutenant M'Ress 

"Spock, quiz the central computer about McCoy and the others."
"Yes, captain. Question: why are we unable to communicate with crewmembers McCoy, Sulu, and Uhura?"
"Answer: that is for me to know and for you to find out."
"Did I hear that right?"
"Affirmative. The dysfunction is more severe than I thought."
 - Kirk, Spock, and the computer

"Okay, whoever you are! So we fell for your juvenile joke! Now get us out!!"
 - McCoy

"I order you to release crewmembers McCoy, Sulu, and Uhura immediately."
"Say please."
"P-l-e-a-s-e."
"Say... pretty... please... with sugar on."
- Kirk and the computer

"Time for a nap, old girl. Captain's orders."
 - Scott

"We're giving it a mighty go with the crowbars though!"
 - Scott

"It's no-o-t fair-r-r-r-r-r..."
 - The Enterprise computer, having lost the energy picked up from the energy field previously passed through

"Turn off those food synthesizers! We're knee-deep in desserts and they're still pouring out!"
 - Romulan commander

Background information
 The first draft script of this episode was issued on . This initial draft was revised on .
 Len Janson also worked on this script but is uncredited.
 This is the second consecutive installment to feature the concept of a practical joker, following the introduction of Ari bn Bem in the episode immediately prior to this one, .
 This episode also includes the first appearance of a holodeck in Star Trek history (and summarily, the "holodeck malfunction"), although it is known here as a recreation room. Gene Roddenberry had intended to introduce a holodeck-type room in the third season of ; however, budget constraints prohibited it. (Inside Star Trek: The Real Story, p. 404) D.C. Fontana, who had worked on the first season of TAS but left for its second and later returned to Star Trek to assist with the inaugural season of , was insistent that the TNG writing staff didn't remember this episode when conceiving the holodecks. ()
 The editors of Trek magazine collectively scored this episode 4 out of 5 stars (a rating that they termed "very good"). (The Best of Trek #1, p. 111)
 In The Star Trek Files magazine, John Peel critiqued, "Not terribly clever, this story is yet another of the 'mad computer' type that the various shows are filled with. We are never told how a second trip through the cloud can cure insanity, nor where the computer managed to produce and inflate a giant balloon of the ship. Nor are we told why the Romulans don't fly around the energy field to continue chasing the humans if they are too scared to enter it. One nice thing in this tale is the Rec Room. The idea of using computer holography to create a mock-up of a planet's surface within a room on the starship is nice, and it makes a good deal of sense. Crews on extended space missions would naturally be most happy to at least have the illusion of a planet about them from time to time. On the other hand, in the simulation that room looked awfully small to contain so much! And how, exactly, did the computer dig a pit in the floor for the revelers to fall into?" (The Star Trek Files: The Animated Voyages End, pp. 41-43)
 In the unofficial reference book Trek Navigator: The Ultimate Guide to the Entire Trek Saga (pp. 179 & 180), co-writers Mark A. Altman and Edward Gross both individually rate this episode 2 out of 4 stars (defined as "mediocre").
 With its depiction of a massive inflatable Enterprise, this is one of "a few" TAS episodes which Andy Mangels considers "goofy." 
 In 's "Ultimate Guide" (), this episode was rated 3 out of 5 Starfleet arrowhead insignia.
 This episode was novelized by Alan Dean Foster in Star Trek Log 6, which was first published in .
 The  was used again – to even greater comic effect – in John M. Ford's novel How Much for Just the Planet?.

Video and DVD releases
 UK VHS release (CIC Video): Volume 7, catalog number VHR 2557, 
 As part of the The Animated Series DVD collection
 As part of the The Animated Series Blu-ray collection

Links and references

Starring
 William Shatner as Captain Kirk
 Leonard Nimoy as Mr. Spock
And
 DeForest Kelley as Dr. McCoy

Also starring
 George Takei as Sulu
 Nichelle Nichols as Uhura
 Majel Barrett as
 M'Ress
 Computer voice
 James Doohan as
 Scott
 Arex
 Enterprise engineer

Guest stars
 Norm Prescott as the Romulan commander
 Lou Scheimer as the Romulan crewman

Background characters
 Enterprise engineer 2
 Enterprise engineers 3, 4

References 
accusation; "ahead of schedule"; air; "all hands"; ambush; amusement; answer; apple; Arex and M'Ress' lunch; assigned sector; asteroid; attack; attack speed; audio tape; bacteria; balloon; banana; ; bearing; behavior; blizzard (whiteout); "bloody"; bluff; "Bones"; ; chance; ; choice; chart; circuit; clown; coincidence; cold-blooded; complaint; computer mode; computer room; console; contact; crowbar; cruise; ; damage; death; death penalty; deck; deflector; density; dessert; "discretion is the better part of valor"; "doggone"; door; drifting; effect; emergency; emergency air; energy drain; energy field; engine; engine room; ; evidence; exit; explanation; Federation; Federation territory; fog; food; food factory; food synthesizer; fool; fork; friend; fun; general alert; geological survey; "get to the bottom of"; ; grape; gravity; grilled cheese; hand; heading (course); ; heathen; Henry IV, Part I; hour; humidification system; humor; ice; icicle; idea; invasion; kidnapping; knee; laughing; laughing gas (nitrous oxide); leg; living matter; logic; logic function; lunch; magnification; main cargo hatch; main computer (aka central computer); medical school; mind; minute; mission; mood; nap; nervous breakdown; odds; officers' mess; "on the double"; ; pear; pessimist; pie; pineapple; ; platter; polarity reversal; power tool; practical joke (prank); practical joker; prank stereoscopic device; prisoner; problem; question; recreation room; repairs; revenge; Romulans; Romulan Neutral Zone; Romulan territory; Romulan warships; room; rye; sandwich; Saurian brandy; seagull; sense of humor; scatterbrain; search party seven; sense of humor; sensor; service chute; size; snow; solution; spacecraft; space dust; Spanish language; speed; "stand by"; Starfleet uniform; stern; subatomic particle; subwarp; sugar; surprise; swim; table; temper; temperature; theory; thing; thought; toast; transmission; trapping pit; treaty; trespassing; trick glass; type 4 asteroid; viewing screen; victim; voice; Vulcans; vulture; walk; wall; war; week; "what the devil"; woods; work crew

Unused references 
hot fudge sundae; vending machine

External links 
 
 
 
 

de:Wüste Scherze
es:The Practical Joker
fr:The Practical Joker (épisode)
it:Il computer si diverte (episodio)
nl:The Practical Joker
Practical Joker, The