added conditions of end of a game