Added end-of-game checks and win dialog.