Subject: misc/16135: Added a feature to the game arithmetic.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <vkhr@rawsocket.net>
List: netbsd-bugs
Date: 03/30/2002 12:45:53
>Number:         16135
>Category:       misc
>Synopsis:       Added a feature to the game arithmetic.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 30 12:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Vic Hari
>Release:        1.5ZA
>Organization:
>Environment:
NetBSD burnt.rawsocket.net 1.5ZA NetBSD 1.5ZA (BURNT) #3: Fri Feb 22 19:01:37 EST 2002     root@burnt.rawsocket.net:/usr/src/sys/arch/i386/compile/BURNT i386

>Description:
The game would show the statistic info and immediately prompt you with a new question, so you lose time, etc. I added a few lines so that it prompts to press any key to continue.
>How-To-Repeat:
Play the game.
>Fix:
*** arithmetic.c	Sat Mar 30 15:38:11 2002
--- arithmetic.c.old	Sat Mar 30 15:31:08 2002
***************
*** 94,100 ****
  int	opnum __P((int));
  void	penalise __P((int, int, int));
  int	problem __P((void));
! void	showstats __P((int));
  void	usage __P((void)) __attribute__((__noreturn__));
  
  const char keylist[] = "+-x/";
--- 94,100 ----
  int	opnum __P((int));
  void	penalise __P((int, int, int));
  int	problem __P((void));
! void	showstats __P((void));
  void	usage __P((void)) __attribute__((__noreturn__));
  
  const char keylist[] = "+-x/";
***************
*** 155,161 ****
  		for (cnt = NQUESTS; cnt--;)
  			if (problem() == EOF)
  				exit(0);
! 		showstats(0);
  	}
  	/* NOTREACHED */
  }
--- 155,161 ----
  		for (cnt = NQUESTS; cnt--;)
  			if (problem() == EOF)
  				exit(0);
! 		showstats();
  	}
  	/* NOTREACHED */
  }
***************
*** 165,178 ****
  intr(dummy)
  	int dummy __attribute__((__unused__));
  {
! 	showstats(1);
  	exit(0);
  }
  
  /* Print score.  Original `arithmetic' had a delay after printing it. */
  void
! showstats(bool_sigint)
! 	int bool_sigint;
  {
  	if (nright + nwrong > 0) {
  		(void)printf("\n\nRights %d; Wrongs %d; Score %d%%",
--- 165,177 ----
  intr(dummy)
  	int dummy __attribute__((__unused__));
  {
! 	showstats();
  	exit(0);
  }
  
  /* Print score.  Original `arithmetic' had a delay after printing it. */
  void
! showstats()
  {
  	if (nright + nwrong > 0) {
  		(void)printf("\n\nRights %d; Wrongs %d; Score %d%%",
***************
*** 180,189 ****
  		if (nright > 0)
  	(void)printf("\nTotal time %ld seconds; %.1f seconds per problem\n\n",
  			    (long)qtime, (float)qtime / nright);
- 	}
- 	if(!bool_sigint) {
- 		(void)printf("Press any key to continue...\n");
- 		while(!getchar()) ;
  	}
  	(void)printf("\n");
  }
--- 179,184 ----

>Release-Note:
>Audit-Trail:
>Unformatted: