Survivor bias. We don’t often think of all the buildings that did not survive, so it is easy to believe all the old buildings did survive.
Also, people back in history weren’t clueless about this stuff. They would know whether an area is prone to flooding or earthquakes and would probably avoid building there. Or at least that applies to the buildings that survived. See, I just explained survivor bias and then immediately fell for it myself.
Latest Answers