- You may be looking for the television story.
Castrovalva, also called the Dwellings of Simplicity, was a city created with block transfer computation by the Master and the power of an enslaved Adric's mathematical skill. It appeared to be a town located on a cliffside of a planet in the Andromeda galaxy.
When the Fifth Doctor needed a place to recover from the effects of his recent regeneration, Nyssa and Tegan brought him to Castrovalva because of a fictional entry placed in the TARDIS information system by Adric. Indeed, the Master intimated that there was never a "real" Castrovalva. Thus, statements from the Index File, such as the "fact" that it was on a planet in the Phylox series, were simply untrue.
The Master's hope was that he could lure the Doctor into a fictional world, then destroy him by "imploding" that world. However, because the Castrovalvans had become self-aware enough for the Doctor to make some of them realised something was amiss with the nature of their own city, the plan failed. One of them, Shardovan, threw himself into the apparatus enslaving Adric, which brought an unplanned end to the city. The Doctor and his companions escaped just as Castrovalva fell in on itself. (TV: Castrovalva) The Master escaped as well. (TV: Time-Flight)
Castrovalva seemed to have an extensive history, its library holding books of information about twelve hundred years' worth of Castrovalvan history — the books, in one of the few mistakes in Castrovalva's make-up wich the Doctor was able to exploit to find out the truth, all appeared several hundreds of years old despite chronicling history up to the present-day. The Castrovalan people did very little except read, but encouraged new ideas. They began hunting for sport at the time of the Doctor's arrival. (TV: Castrovalva)