It seems that the cleaning process does not always filter out all invalid players. There's an example below - be warned that it's kind of convoluted.
The crux of the issue in the example is that during the pass to remove any hospitals, some residents' final preference is removed, thus making them invalid. I think a solution to this would be return a boolean from the input checker, and then loop through removing residents and hospitals until nobody further is removed.
It seems that the cleaning process does not always filter out all invalid players. There's an example below - be warned that it's kind of convoluted.
The crux of the issue in the example is that during the pass to remove any hospitals, some residents' final preference is removed, thus making them invalid. I think a solution to this would be return a boolean from the input checker, and then loop through removing residents and hospitals until nobody further is removed.