Remove extraneous underscores at start and end of Rectangles seeds.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 17 Aug 2004 11:51:20 +0000 (11:51 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 17 Aug 2004 11:51:20 +0000 (11:51 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/puzzles@4473 cda61777-01e9-0310-a592-d414129be87e

rect.c

diff --git a/rect.c b/rect.c
index b9d7cda..06ccff6 100644 (file)
--- a/rect.c
+++ b/rect.c
@@ -881,7 +881,13 @@ char *new_game_seed(game_params *params, random_state *rs)
                     run -= c - ('a' - 1);
                 }
             } else {
                     run -= c - ('a' - 1);
                 }
             } else {
-                *p++ = '_';
+                /*
+                 * If there's a number in the very top left or
+                 * bottom right, there's no point putting an
+                 * unnecessary _ before or after it.
+                 */
+                if (p > seed && n > 0)
+                    *p++ = '_';
             }
             if (n > 0)
                 p += sprintf(p, "%d", n);
             }
             if (n > 0)
                 p += sprintf(p, "%d", n);