From 4b2930c4334d75ef1981a6a825d5ea51b5edbe5c Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Wed, 23 Jul 2014 16:06:49 -0500 Subject: [PATCH] Adjust the appearance of the end of game text --- apple2048.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apple2048.c b/apple2048.c index a66c1a0..46dfe25 100644 --- a/apple2048.c +++ b/apple2048.c @@ -34,6 +34,7 @@ void printInstructions(void) "\n" " PRESS ANY KEY TO START"); + // The amount of time the user waits to read the in while (!kbhit()) seed++; @@ -79,17 +80,19 @@ void printBoard(void) void gameWon(void) { - printf("\nCONGRATULATIONS, YOU HAVE WON THE GAME!\n"); + gotoxy(0, 22); + printf("YOU HAVE WON THE GAME! PRESS ANY KEY...\n"); cgetc(); - exit(0); + initGame(); } void gameLost(void) { - printf("\nSORRY, NO MORE MOVES.\n"); + gotoxy(0, 22); + printf("SORRY, NO MORE MOVES. PRESS ANY KEY..."); cgetc(); - exit(0); + initGame(); } @@ -149,11 +152,10 @@ int main(void) if (isGameWon()) gameWon(); - - if (isGameLost()) + else if (isGameLost()) gameLost(); - - handleNextEvent(); + else + handleNextEvent(); } return 0;