"Castrovalva" is the first story of the nineteenth season of Doctor Who, and was first broadcast as four episodes in January of 1982. It was the first story to feature The Fifth Doctor, played by Peter Davison. It also starred Matthew Waterhouse as Adric, Sarah Sutton as Nyssa and Janet Fielding as Tegan Jovanka, and featured Anthony Ainley as The Master.
The story is the conclusion of a three-part story arc, beginning in the previous season, that included The Keeper of Traken and Logopolis. It is unique amongst Doctor Who stories in carrying a story arc across a season, as well as across a regeneration. All of the stories involve The Doctor foiling The Master's diabolical plots, which involve everything from enslaving a world to destroying the universe to just getting revenge on The Doctor. At the end of Logopolis, The Fourth Doctor dies after a long fall, and regenerates into The Fifth Doctor, who immediately finds himself in the middle of this confusion, while also suffering from amnesia and dementia from the strain of regeneration. After resting in a zero room and briefly shaking himself awake long enough to escape the TARDIS getting burnt in the formation of The Milky Way, The Doctor, Nyssa and Tegan head to Castrovalva, a place that the TARDIS computer says he can rest. But the Master has Adric and is laughing maniacally to himself, and something in Castrovalva doesn't seem right...
The plot, while interesting (and of course, too complicated to sound sane in a synopsis), isn't that extraordinary, being a typical case of foiling a nefarious scheme. What is interesting is the new way the role of The Doctor is treated, both by the writers, the production team, and Peter Davison. Physically younger, this Doctor also acts more modest, not being the all-knowing action hero that the previous two Doctors were. This is in part exacerbated by the illness of the Doctor: he spends most of one of the episodes being carried around in a box by two of his companions. And the companions, rather as acting as plucky assistants to a swashbuckling hero, act like members of a team.
Although I don't know how much of it is intended, I also find the episodes focus on recursion to be parallel to the idea of regeneration. The regenerating Doctor, no longer an all-powerful, all-knowing figure, is reduced to being a child, seeking for guidance from those around him. And in doing so, he must learn to define himself through terms he invents himself: a type of self-creation. This is also demonstrated in one of the final statements of the residents of Castrovalva, whose very identity is not what they think it is at first: despite being created and controlled by someone else, they still have the ability to declare themselves free. So the story seems to make a point of existential self-direction.
And all of this is a big step upwards from the campy stories that marked the end of the Fourth Doctor's run, and is a promising sign of the episodes ahead.