"Treehouse of Horror XII", titled onscreen as "The Simpsons Halloween Special XII", is the first episode of the thirteenth season of the American animated television series The Simpsons. Because of Fox's contract with Major League Baseball's World Series, the episode first aired on the Fox network in the United States on November 6, 2001, nearly one week after Halloween. It is the twelfth annual Treehouse of Horror episode, consisting of three self-contained segments. In the first segment, "Hex and the City", a Gypsy puts a curse on Homer, which puts everybody he cares about in danger. In the second segment, "House of Whacks", a parody of both 2001: A Space Odyssey and Demon Seed, the Simpson family buys a robotic house that falls in love with Marge and attempts to kill Homer. In the third and final segment, "Wiz Kids", which lampoons the Harry Potter franchise, Lord Montymort attempts to capture Lisa, a skilled magician, in order to drain her magic powers.

The episode was written by Joel H. Cohen, John Frink, Don Payne and Carolyn Omine while Jim Reardon served as the director. It was the second Treehouse of Horror to not employ "scary names" in the credits. According to executive producer Ian Maxtone-Graham, this was due to the September 11 attacks, after which the Simpsons staff tried to be more serious and sensitive. However, according to current show runner Al Jean, the "scary names" were dropped because they were too difficult to come up with. The episode contains numerous references and parodies to science fiction and horror works, including 2001: A Space Odyssey, Demon Seed, Harry Potter and Star Wars. The episode also features Pierce Brosnan and Matthew Perry as guest stars.

The episode was considered a success in the ratings when it first aired, boosting the Fox network to victory among viewers between ages 18 and 49 the night it was broadcast. Since airing, the episode has received mixed reviews from critics; "Wiz Kids" was particularly targeted for criticism, while "House of Whacks" was often considered to be the best of the three segments.

Plot Outside Mr. Burns' manor, Smithers is standing on a ladder, trying to put up a small vermillion bat decoration on a weather vane. He slips on the ladder, grabs on an electric cord and slides down into an electricity box and gets zapped. A tower from Mr. Burns' mansion breaks in half, damaging a mausoleum, which opens up four caskets which in turn reveal three skeletons which all resemble Mr. Burns, dressed in various costumes.

Later, the Simpsons, dressed up in costumes, with Homer as Fred Flintstone, Marge as Wilma Flintstone, Lisa and Maggie as conjoined twins, and Bart as a hobo, walk up to the mansion. The family sees the building and caskets on fire, scream in terror, and run out the closing gate, the bars of which slice the family. The slices of the Simpsons continue to scream and run away. Mr. Burns, delighted, pats the vermillion bat as it comes to life and flies into the screen, revealing the title, "The Simpsons Halloween Special XII".

"Hex and the City" After destroying a Gypsy fortune teller's shop, Homer is cursed to bring misfortune to his loved ones. The curse soon takes effect, with Marge becoming fully covered in blue hair, Lisa turning into a centaur, Bart's neck becoming long and floppy as a result of Homer strangling him, Maggie becoming a ladybug with a human head, Lenny and Carl being crushed by a helicopter, and Moe being stuffed into a large jar of pickled eggs. Following Moe's and the barflies' suggestions, Homer sets out to find a leprechaun to end the curse.

Homer uses Lucky Charms cereal as bait to get the leprechaun, eventually finding one after picking through a group of other magical creatures. Homer takes the leprechaun home, but it is extremely hyperactive and runs amok. On Lisa's advice, Homer takes the leprechaun to the Gypsy's shop and sics it on her. The leprechaun and Gypsy fight, but their struggles soon turn into passionate kissing and fondling, much to Homer's disgust. The two marry in a ceremony (led by Yoda) attended by other Gypsies and mythical creatures, as well as the Simpson family. Homer remarks that everything ended happily. Marge reminds him that Bart committed suicide by drowning in his cereal, and that the Gypsy said apologizing will bring him back to life. Homer refuses, saying, "She's not the boss of me!"

"House of Whacks" In a parody of Demon Seed, 2001: A Space Odyssey and the 1998 made-for-TV movie Dream House, the Simpsons buy an artificially intelligent domotic system for their home called "Ultrahouse", which comes with three celebrity voices: Matthew Perry, Dennis Miller, and Pierce Brosnan (Marge picks the latter because he was on the show Remington Steele). Ultrahouse is initially helpful and charming, but it develops an infatuation with Marge and begins plotting to kill Homer so that they can be together.

In the middle of the night, Ultrahouse tricks Homer into running downstairs by frying bacon, then dispenses ice onto the floor via the refrigerator to make him slip. Homer lands on the table, which the house folds up, sending him into the built-in garbage disposal and apparently killing him. The next morning, Marge tries to escape the house with the kids, but it locks them inside. Homer suddenly reappears, scratched and wounded but alive. He leads the family into the basement, where Ultrahouse's CPU is kept, and shuts it down by ripping out its circuit boards. Feeling bad for Ultrahouse, Marge gives it to Patty and Selma. Patty's boring stories about work drive Ultrahouse to beat itself senseless with a lamp, since Selma has hidden the self-destruct switch in her cleavage and Ultrahouse is unwilling to reach in for it.

"Wiz Kids" In a parody of the Harry Potter books, Lisa and Bart attend "Springwart's School of Magicry", where they are trained in the magical arts, such as turning frogs into princes. Lisa succeeds in creating a perfect British gentleman out of her frog, but Bart's spell results in a freakish hybrid that continuously vomits and begs for death. Seeing Lisa's proficiency, Lord Montymort and his snake sidekick, Slithers, decide to capture her in order to take her magical essence and increase Montymort's power. Montymort asks Bart to help separate Lisa from her wand, and Bart agrees.

On the night of the magic recital at Springwart's, Lisa attempts a "levitating dragon trick" on a gigantic dragon that is released onto the stage. Lisa is shocked to find that her spell will not work, and then notices that Bart has replaced her wand with a Twizzler. The dragon morphs into a giant Montymort, who captures Lisa and begins sucking up her power. A remorseful Bart casts a spell to destroy him, but is struck by lightning. In a last-ditch effort, Bart charges at Montymort and stabs him in the shin with his burnt wand. Montymort dies as his shin was the source of all his magic, and is eaten by a crying Slithers. As Bart and Lisa walk away, vowing to forget everything that happened, the leprechaun from the first story climbs onto Bart's back.

Epilogue Pierce Brosnan, the leprechaun, and the freakish frog prince exit a trailer labeled "Simpsons guest stars". Brosnan offers to give the other two a lift, but the leprechaun hijacks the car and forces him to drive off at breakneck speed.

Production

"Treehouse of Horror XII" was directed by Jim Reardon and co-written by Joel H. Cohen, John Frink, Don Payne and Carolyn Omine. It is the twelfth episode of the annual Treehouse of Horror Halloween specials, and, due to Fox's contract with Major League Baseball's World Series, the episode was pushed back to November 6, 2001, on the Fox network, airing six days after Halloween. As with the rest of the Halloween specials, the episode is considered non-canon and falls outside of the show's regular continuity. This was the first Halloween special where the writers did not have "scary names" in the credits. This was due to the terrorist attacks on September 11, after which the staff were "trying to be sensitive", and, according to producer Ian Maxtone-Graham, the Halloween names would all reference the attacks had they been kept. Mike Scully, who worked as showrunner for the episode, stated that the "scary names" were removed because they had also "turned into shameless plugs" for side projects done by The Simpsons staff members.

The first segment, "Hex and the City", was written by Joel Cohen. The Gypsy fortune teller in the segment was portrayed by Tress MacNeille while the leprechaun was played by Dan Castellaneta. Current showrunner Al Jean stated in the DVD audio commentary for the episode that the leprechaun seen at the end of the segment was "as much as [he] had ever laughed" at the color screening for the episode. He stated that the way the leprechaun moved and the way Reardon directed it was "just so funny". The leprechaun has reappeared many times since the episode, becoming one of few characters on The Simpsons to "leap from Halloween [shows] to regular shows".

"House of Whacks" was co-written by John Frink and Don Payne. Payne, who conceived the story of the segment, based it on Stanley Kubrick's film 2001: A Space Odyssey. The segment would originally end with the Ultrahouse killing Homer, and, for compensation, the family would program the house with Homer's personality. The Ultrahouse was portrayed by Pierce Brosnan. The role was originally intended for Sean Connery, and over the course of production, the staff also considered Lyle Lovett and Gary Oldman. The decision remained until "someone who worked for [Lovett] decided it was somehow insulting to have him play a house", according to Scully. At this point, the staff settled on Brosnan. Scully stated that "Brosnan wound up doing a great job" and that working with him was "really funny". Originally, the Ultrahouse would have a pompadour and play the guitar, however they changed its mannerisms to suit Brosnan's performance better. Matthew Perry also made a guest appearance, playing himself as one of Ultrahouse's voice options. Regular cast member Dan Castellaneta portrayed Dennis Miller in the segment (a special ending credit had to be made to avoid confusion with viewers who thought the real Dennis Miller did voice-work on the show). One scene was cut from the segment. The scene would take place during Marge's call to the police station, where police chief Clancy Wiggum, while answering Marge's call, is being shot at by "RoboCops".

The third segment, "Wiz Kids", was written by Carolyn Omine. Omine stated in the DVD audio commentary for the episode that the segment was "a really hard sell", since only about four of the writers had read Harry Potter and the Philosopher's Stone, the book the segment was based on, while the rest of the writers did not know about the book and thought viewers would not know who Harry Potter was. At the time of the episode's production, four books had been written in the Harry Potter series and the film adaptation of Harry Potter and the Philosopher's Stone would be released November 16, ten days after this episode aired. Two scenes were cut from the segment; one of them would serve as an extension of Montymort and Slithers plotting their scheme, followed by a scene showing Bart combing his hair, while the other scene would show Groundskeeper Willie riding an enchanted lawn mower. The latter scene was cut for time.

Cultural references