added game end condition