The Medieval Castle: A Study of Architecture and Defense