Determined if player has won or lost the game then terminates the
program.