built code for finishing a game