From b2f1f53188fad3de446b7b5532c35846cbfaa898 Mon Sep 17 00:00:00 2001 From: Duncan Mak Date: Wed, 7 Aug 2002 05:44:03 +0000 Subject: [PATCH] 2002-08-07 Duncan Mak * sample/Fifteen.cs: Fixed scramble. The whole thing works now. svn path=/trunk/gtk-sharp/; revision=6493 --- ChangeLog | 4 ++++ sample/Fifteen.cs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9146a431d..fcd7fc933 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-08-07 Duncan Mak + + * sample/Fifteen.cs: Fixed scramble. The whole thing works now. + 2002-08-06 Rachel Hestilow * generator/SignalHandler.cs: Handle null arguments and return values. diff --git a/sample/Fifteen.cs b/sample/Fifteen.cs index 74b6d40d6..142c169c0 100644 --- a/sample/Fifteen.cs +++ b/sample/Fifteen.cs @@ -183,7 +183,7 @@ public class Fifteen for (int i = 0; i < SCRAMBLE_MOVES; i++) { retry: - int dir = rand.Next (); + int dir = rand.Next (4); int x = 0, y = 0; if ((dir == 0) && (position > 3)) // up @@ -194,8 +194,9 @@ public class Fifteen x = -1; else if ((dir == 3) && ((position % 4) != 3)) // right x = 1; - else + else { goto retry; + } int old_position = position + y * 4 + x; board [position] = board [old_position];