[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] slightly changed semantics of --seed option
From: |
Gunnar Farneback |
Subject: |
[gnugo-devel] slightly changed semantics of --seed option |
Date: |
Tue, 27 May 2003 00:20:54 +0200 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode) |
Currently the random seed is initialized to time(0) if either the
--seed (or -r) option is not used or if it specifies the random seed
0. This has the drawback that it's impossible to set the random seed
to 0.
This patch changes the semantics so that the random seed is set to
time(0) only if --seed is not used and otherwise to the specified
value.
Does this change in semantics risk to break anything?
- change of semantics for --seed option
/Gunnar
Index: interface/main.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v
retrieving revision 1.70
diff -u -r1.70 main.c
--- interface/main.c 1 May 2003 20:55:26 -0000 1.70
+++ interface/main.c 26 May 2003 07:30:49 -0000
@@ -305,6 +307,7 @@
* (Change seed to get a different game).
*/
int seed = 0;
+ int seed_specified = 0;
komi = 0.0;
@@ -367,7 +370,7 @@
break;
case 'b': benchmark = atoi(gg_optarg); playmode = MODE_SOLO; break;
- case 'r': seed = atoi(gg_optarg); break;
+ case 'r': seed = atoi(gg_optarg); seed_specified = 1; break;
case 'S': showstatistics = 1; break;
case 'w': printworms = 1; break;
case 'm': printmoyo = strtol(gg_optarg, NULL, 0); /* allows 0x... */
break;
@@ -903,7 +906,7 @@
}
/* Start random number seed. */
- if (!seed)
+ if (!seed_specified)
seed = time(0);
/* Initialize the GNU Go engine. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] slightly changed semantics of --seed option,
Gunnar Farneback <=