We present a model of the Wisconsin Card Sorting Test, a classical neuropsychological test frequently used to assess deficits in executive functioning. The model is grounded in a cognitive architecture based on the Supervisory System theory of Norman and Shallice (1986) and evaluated against data from control subjects and several groups of neurological patients as reported by Stuss et al. (2000). The model is able to account for control performance across a range of dependent measures. When damaged in theoretically motivated ways it is also able to capture the behaviour of the different patient groups. Specifically, the model supports the association by Shallice et al. (2008) of the function of task-setting to left lateral prefrontal cortex, of the function of attentiveness to inferior medial prefrontal cortex, and of the function of monitoring to right lateral prefrontal cortex. The implication of these results for the supervisory system architecture and the localisation of function within prefrontal cortex are discussed.