- 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 Doctor was able to make some of the Castrovalvans self-aware, 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 from twelve hundred years ago 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)