Implemented end-game conditions