/* File: guess.c
Programmer: Tep Dobry
login: tep
Date:
*/
/* This module is responsible for overseeing the entire program; invoking
the other modules as appropriate. It is the module allowing the
user to play the game repeatedly.
*/
#include <stdio.h>
#include "guess.h"
#include "play.h"
#include "tfdef.h"
#define DEBUG
main()
{ int keep_playing = TRUE; /* do we keep playing? initially true. */
int hidden_number; /* the picked random number */
/* Introduce the game */
printf("\n\n\t\tWelcome to the Guessing Game\n");
/* While the player wants to keep playing */
while( keep_playing )
{ /* pick a random number between START and STOP */
hidden_number = PICK(START,STOP);
/* introduce the play */
printf("\nI'm thinking of a number between %d "
"and %d\nCan you guess it?\n\n",START,STOP);
#ifdef DEBUG
printf("debug:main:the pick is %d\n",hidden_number);
#endif
/* play the game */
play(hidden_number);
/* ask the player if they want to continue */
printf("\nDo you want to play again?\n");
printf("(1 for yes, 0 for no): ");
scanf("%d", &keep_playing);
}
/* say goodbye */
printf("\nThanks for the game.... bye...\n");
}