~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Patch from James H: tinker with the presets on SLOW_SYSTEMs.
[sgt/puzzles]
/
samegame.c
diff --git
a/samegame.c
b/samegame.c
index
60e0272
..
d8c58ac
100644
(file)
--- a/
samegame.c
+++ b/
samegame.c
@@
-149,7
+149,11
@@
static game_params *default_params(void)
static const struct game_params samegame_presets[] = {
{ 5, 5, 3, 2, TRUE },
{ 10, 5, 3, 2, TRUE },
static const struct game_params samegame_presets[] = {
{ 5, 5, 3, 2, TRUE },
{ 10, 5, 3, 2, TRUE },
+#ifdef SLOW_SYSTEM
+ { 10, 10, 3, 2, TRUE },
+#else
{ 15, 10, 3, 2, TRUE },
{ 15, 10, 3, 2, TRUE },
+#endif
{ 15, 10, 4, 2, TRUE },
{ 20, 15, 4, 2, TRUE }
};
{ 15, 10, 4, 2, TRUE },
{ 20, 15, 4, 2, TRUE }
};
@@
-398,11
+402,6
@@
static void gen_grid(int w, int h, int nc, int *grid, random_state *rs)
if (n == 0)
break; /* we're done */
if (n == 0)
break; /* we're done */
- /*
- * Shuffle the list.
- */
- shuffle(list, n, sizeof(*list), rs);
-
#ifdef GENERATION_DIAGNOSTICS
printf("initial grid:\n");
{
#ifdef GENERATION_DIAGNOSTICS
printf("initial grid:\n");
{
@@
-420,13
+419,17
@@
static void gen_grid(int w, int h, int nc, int *grid, random_state *rs)
#endif
/*
#endif
/*
- * Now go through the list one element at a time and
- * actually attempt to insert something there.
+ * Now go through the list one element at a time in
+ * random order, and actually attempt to insert
+ * something there.
*/
while (n-- > 0) {
int dirs[4], ndirs, dir;
*/
while (n-- > 0) {
int dirs[4], ndirs, dir;
- pos = list[n];
+ i = random_upto(rs, n+1);
+ pos = list[i];
+ list[i] = list[n];
+
x = pos % w;
y = pos / w;
x = pos % w;
y = pos / w;