game end condition check and relevant action