Fixed end-game conditions
Refactor and aiplayer test