GNOME Bugzilla – Bug 438829
Robots dies on level 64 with a score near 250000
Last modified: 2007-07-13 01:01:33 UTC
+++ This bug was initially created as a clone of Bug #353303 +++ Bug #353303 is still happening; the patch in #353303 did not fix it. Description of the bug: if there are so many robots that there are no safe teleports left, and you press the safe teleport button, the program freezes. The problem is that in the safe_teleport() function in gnobots2/game.c, safe_teleport_available() is only checked when properties_super_safe_moves() is true; and when it isn't checked, the code gets stuck in the while (1) { ... } loop a few lines further down. BTW, you do not need to play to level 64 to test the bug; just change the initial number of robots in /usr/share/<variant>.cfg to some huge number (type1 = 200 and type2 = 400, for example) before starting gnobots2.
Created attachment 88265 [details] [review] this patch fixes the bug
> initial number of robots in /usr/share/<variant>.cfg to some huge number (type1 That should be /usr/share/gnobots2/<variant>.cfg, or course.
Created attachment 88892 [details] [review] the same patch as 88265, but against the SVN HEAD
Confirmed. The current code is bogus. If you can't teleport to any safe place, then you can't move to any safe place either. Or randomly teleport to any. It just doesn't make sense. So the patch looks good to me. (btw. this is actually a duplicate of bug #395447)
Committed to trunk. Thanks for the patch Ferenc!