implementation. judgement of game end.