Bug 35477

Summary: Gnibbles tries to load level 0
Product: [Retired] Red Hat Linux Reporter: Jeff Ozvold <corsalini>
Component: gnome-gamesAssignee: Jonathan Blandford <jrb>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: ddumas
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-04-11 18:33:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeff Ozvold 2001-04-10 18:13:58 UTC
There's a bug in the random level code.  One time that it checks

       rand() % MAXLEVEL

       it forgets to add one.  Here is a patch:


diff -ur gnome-games-1.1.90/gnibbles/main.c gnome-games-1.1.90-jjo/gnibbles/main.c
--- gnome-games-1.1.90/gnibbles/main.c  Tue Apr  3 13:54:25 2001
+++ gnome-games-1.1.90-jjo/gnibbles/main.c      Tue Apr  3 13:52:41 2001
@@ -488,7 +488,7 @@
               if ((current_level < MAXLEVEL) && !properties->random)
                       current_level++;
               else if (properties->random) {
-                       tmp = rand () % MAXLEVEL;
+                       tmp = rand () % MAXLEVEL + 1;
                       while (tmp == current_level)
                               tmp = rand () % MAXLEVEL + 1;
                       current_level = tmp;

Comment 1 Jonathan Blandford 2001-07-10 00:00:55 UTC
fixed