The TARDIS arrives in a mock-up of the first Moon landing and the Doctor escorts, Clara, Angie, and Artie out. He explains that they're at Hedgewick's World, the biggest amusement park in existence, and flashes his golden ticket. The kids assume that they are actually are on the moon, but a man steps out of a fake rock and asks if they're the discount removal service he called to get a ride off-planet. A platoon of soldiers march in and the man, Mr. Webley, promptly hides. The lead soldier, the Captain, tells them that the planet is closed by Imperial order. The Doctor flashes his psychic paper, identifying himself as a proconsul, and the Captain is convinced. She asks for word of the Emperor and says that they all pray for his return.
Once the platoon moves out, Webley comes back out and offers to show the Doctor and his party around. He shows them the vast amusement park but admits that it's closed down, and then takes them to his private collection of collectibles. They look around and Webley offers to show them the prize of his collection: a Cyberman. The Doctor orders everyone down, but Webley explains that it's an empty shell, programmed to play chess. As they talk, they're unaware that several wormlike creatures in the room monitor their every word and action.
Artie offers to play the Cyberman and Webley demonstrates that there is nothing inside. They begin the game and Artie quickly loses. The Doctor realizes the trick and opens a hidden panel, revealing a man inside controlling the Cyberman. He hops out and introduces himself as Porridge, unaware that more of the wormlike creatures are scurrying around.
Webley shows off the other two Cybermen in his collection, and all inactive. There's a statue of the Emperor, and when Clara speaks dismissively of him, Porridge warns her that talk like that is considered treasonous. Webley then takes the group back to the moon display and turns on the anti-gravity ride. Once the kids are done, Clara wants to take them home but the Doctor says that he's not ready to leave. He scans and detects the worm creatures and says he wants to investigate. They go back to Webley's quarters and they leave Artie and Angie to take a nap in the main room.
Webley goes back to the Cyberman at the chessboard and sets things back up. It comes to life and grabs his wrists, and the cybernetic worms crawl out of its eyeholes and onto him, upgrading him.
Angie tries to get phone service without success and decides to wander off. As she argues with Artie, the Cybermites scurry over her discarded cell phone.
Clara and Porridge follow the Doctor as he looks around. Porridge explains that the amusement planet was trashed during the Cyberwars. The Cybermen kept upgrading themselves and the Emperor finally unleashed a bomb that destroyed the Tiberian Galaxy, destroying the Cybermen once and for all. Porridge admits that sometimes he feels sorrier sorry for the Emperor for having to make the choice, than the trillions of people who died. The Doctor interrupts to tell them that he's just seen Angie going into the barracks.
In the barracks, the Captain is talking to her tech specialist, Beauty, who reports that all of the components inside their comm unit have disappeared. As another soldier, Brains, informs the Captain that the weather control unit isn't working. Angie comes in and says that she's bored. When she mentions the little bloke Porridge, the Captain takes an interest and says that they have to have a chat.
Artie looks around nervously and goes to turn the lights back on. A Cyberman grabs him from behind, gagging him.
As Angie starts to explain about Porridge, the Doctor and Clara come in. A Cyberman enters the room and then accelerates forward, knocking out one soldier. The Captain and her troops open fire but it upgrades to resist the weapons, then superspeeds forward, grabs Angie, and runs out of the room. The Doctor promises Clara that he'll get her back and asks to speak with the Captain. She admits that they haven't done much fighting and that assignment to the platoon is used for punishment. The Doctor puts Clara in charge, tells her that he'll be back, and goes out to find Angie and Artie.
The Cyberman takes Angie to Webley's exhibit room. Artie and Webley have already undergone Cyberconversion and the "new" Artie tells his sister that she will be upgraded.
The platoon unloads their anti-Cyber weaponry while the Captain and Clara try to find a defensible position on the park map. They finally decide to go to the Comical Castle to take up a defensible position. The Captain suggests that they blow up the planet but Clara refuses. Porridge comes in and the Captain addresses him as Sir, and he confirms that they're out of touch with the Imperium.
The Doctor returns to Webley's exhibition and finds a Cybermite. He addresses it, warning the Cybermen that the children are under his protection. The Doctor then shuts it down and goes to the chess room, and discovers that the Cyberman is gone. Examining the Cybermite, he activates the transmit link and is teleported to a chamber. Artie and Angie, both converted, are standing immobile. Cyber-Webley steps forward and says that they needed children, but children stopped coming to the amusement park. He hails the Doctor as the savior of the Cybermen for bringing them children.
Clara, Porridge, and the platoon go to the Comical Castle and Clara insists that they do what the Doctor says.
Cyber-Webley tells the Doctor that the Cybermen built a refuge on the planet and brought people there to serve as spare parts for their injured Cyberunits. They needed children to build a new Cyberplanet, using their brains with infinite potential. However, the Cybermites have scanned the Doctor's brain and realize that he has much more potential. The Doctor points out that the Cybermen can't convert non-humans, but Cyber-Webley explains that the Cybermen have upgraded themselves so that they now can. He throws Cybermites on the Doctor and cyberware spreads on his face. The Doctor tries to resist, able to see within the Cyberiad network, and wonders how many Cybermen there are. The Cyber-Doctor doesn't answer and realizes how efficient he has become, and dubs himself Mr. Clever.
The Doctor, continuing their mental confrontation, warns that he could initiate a regeneration sequence and burn Mr. Clever out, but admits that he doesn't want to. Mr. Clever realizes that they have a stalemate and the Doctor suggests that they play a game of chess for who will control his brain. Whoever loses will concede control to the winner.
One of the soldiers, Missy, patrols the Castle's power station and sees a Cyberman moving in the shadows. She calls it in and then runs and hides as the Cyberman advances on her. It passes her by but then releases one of its hands. The hand crawls back and grabs Missy's face.
Brains informs Clara about Missy's report and she inspects the anti-Cyber weaponry. The platoon only has one gun and several grenades. If the grenade is attached to the back of a Cyberman's head, it will generate an EMP blast, destroying it. The final weapon is a planetary implosion device and it's programmed to obey the Captain's voice. When Clara tells her not to activate it without orders, the Captain insists that she'll follow her orders. Clara reminds her that she's the only one authorized to give her orders, while Porridge takes one of the grenades. The Captain orders him upstairs so she can instruct him on how to use it.
Mr. Clever sets up the chessboard and they begin the game. As they play, Mr. Clever asks why there's no record of the Doctor in the Cyberiad databanks, and realizes he's been eliminating himself from history. He insists that the Doctor can't possibly wins, but the Doctor points out that older Cybermen were vulnerable to substances like gold and cleaning fluid... and Mr. Clever is still running some of that code. The Doctor then slaps the gold ticket onto the cyberware on his face, disrupting Mr. Clever's control. He grabs the chessboard and tells Webley and the children to come with him.
Once they're alone, Porridge realizes that the Captain knows who he really is. As they talk, a Cybermite monitors them. The Captain insists that her platoon can't beat the Cybermen and she can only send a trigger by activating the bomb. Porridge forbids her to do it, as Clara walks up. He explains that the only way to permanently eliminate the Cybermen is to take drastic action. The Captain says that she was assigned to the platoon and didn't implode a planet the last time she confronted the Cybermen, and promises to make up for it. As she activates the implosion device, a Cyberman fires from the ground below, killing her. Realizing that they're pinned down, Clara tells the surviving platoon members that they're going to take the fight to the Cybermen.
The soldiers split up and one of them spots a Cyberhead behind a crate. She slaps the grenade on, only to realize that the Cyberman has detached his head. The body grabs the soldier from behind and kills her. Another Cyberman kills two of the soldiers. Another one, Ha-Ha, lures it toward him and then ducks out of the way as Clara fires n energy blaster at it, disintegrating it. However, the "dead" soldiers come back to life, converted to Cybermen. Two of the other soldiers deactivate them
The Doctor arrives at the castle with Webley, Artie, and Angie in tow. He explains the situation to Clara and asks for a place where he can set up his chessboard so he can win his game... and has them immobilize him except for his hands.
Once he's tied up, the Doctor removes the gold ticket. Mr. Clever warns Clara that the Doctor only has a 25% chance of winning, and tells her that she's the impossible girl. When she wonders why she's impossible, Mr. Clever refuses to answer her question and offers her the chance to join them. As he talks, the Doctor's hand scribbles out a message: "hit me!" When she slaps him, the neural surge lets the Doctor regain control temporarily. Clara repeats her question and he says that he'll explain later. The Doctor admits that if he wins, Mr. Clever will break his word and still try to kill them all. Mr. Clever regains control and tells Clara to prepare to die while he finishes the chess game.
Clara goes to check with the surviving soldiers and notices a power cable. She suggests that they drop the cable into the moat and fry the Cybermen when they advance. They do so and raise the drawbridge.
The Doctor and Mr. Clever alternate control of the body to make their moves. As they play, Mr. Clever activates the Cybermen stored beneath the planet's surface. Three million of the creatures begin their march to the surface.
Come morning, Porridge makes some food for Clara. The Doctor calls her in and asks her for the implosion device's trigger. Suspecting a trap, Clara asks the Doctor to tell her something only the Doctor knows. He tells her how funny and pretty is, and that he's starting to like her in a different way. Clara slaps him, realizing it's Mr. Clever, and the Doctor regains control. She says that even if what the Doctor was saying was true, he'd rather die than say it. Mr. Clever takes control of the body and grabs Clara's hand with the trigger device, and smashes it. He then takes control and yells that the Cybermen are there.
As the Cybermen surround the Castle, Mr. Clever tells the Doctor that it's time for the end game. The first Cyberman steps into the moat and shorts out… and then upgrades to resist it. The Cybermen march across the moat and Clara gives their only gun to Ha-Ha while the other soldiers take defensive positions. They destroy the first Cyberman in but the others continue their relentless march. Meanwhile, Porridge grabs the implosion device, complaining that he should have destroyed the planet when he had the chance.
Mr. Clever offers the return of the children if the Doctor sacrifices his queen, losing him the game in five moves. The Doctor accepts and Mr. Clever frees Angie and Artie. As they talk, Porridge comes in with the implosion device while Cyber-Webley welcomes the children. Porridge hits Cyber-Webley with a grenade. Cyber-Webley kicks Porridge away, stunning him, before the grenade immobilizes him.
The Cybermen adapt to the anti-Cyber weapon and overwhelm the soldiers.
The Doctor tells Mr. Clever that sacrificing his queen was the best move he could have made. He says that giving up the queen was his trap, and he will win in three moves. Mr. Clever demands to know how he can win, and the Doctor tells him to draw on more processing power to figure it out.
The Cybermen reach for Clara and the others to convert them... and freeze. Inside, Mr. Clever says that he's allocating all of his processing power to solve the problem, and tells the Doctor that he's only delayed the inevitable. The Doctor announces his three moves. First he turns on his sonic screwdriver, then he activates the pulse grenade that he took from Porridge. Finally he activates it and slaps it onto his face. Clara and the others come running in and untie him, and the Doctor warns that the Cyberplanner is back distributed across the three million Cybermen.
The Doctor examines the implosion device and confirms that it has a fallback voice-activation circuit. Angie points out that Porridge is the Emperor and suggests that he knows the activation codes. She points out that Porridge looks just like the waxwork and the image on the coins, just taller. Porridge admits that Angie is right and that if he activates the bomb, it will be all over for him.
The Cybermen reactivate and march on into the Castle.
When the Doctor points out that three million Cybermen will overrun the galaxy if Porridge doesn't act, the Emperor gives the code phrase to activate the device. The Imperial Flagship locks onto his location and teleports him and the others aboard, and the Doctor has him transmit the TARDIS aboard as well. They then turn to the screen and watch as the planet implodes.
Porridge admits that it felt good to run away for a while, but that his people will be keeping a closer eye on him now. He then turns to Clara and asks if she'll marry him. The Doctor tries to offer his advice but Clara says that it's none of his business. She thanks Porridge for the offer but says that she doesn't want to rule a thousand galaxies. Porridge jokingly suggests that he have them all executed and then tells them to get out of there before he changes his mind.
Later, the Doctor takes Angie and Artie home. Once they leave, Clara thanks him for everything and then leaves. Once he's alone, the Doctor again wonders how Clara can possibly exist.
Porridge makes sure that there's no sign of Cyberware and then leaves for home... unaware that one Cyberman's head is drifting through space.