gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] initialize globals in globals.c


From: Arend Bayer
Subject: [gnugo-devel] initialize globals in globals.c
Date: Mon, 26 Sep 2005 00:43:23 +0200 (CEST)

For some reason, many global variables get initialized to a constant
in main() in main.c, instead of just initializing them with their
declaration in globals.c. (In fact, many got even initialized twice.)
I see no reason for this.

Arend


Index: engine/boardlib.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/boardlib.c,v
retrieving revision 1.7
diff -u -p -r1.7 boardlib.c
--- engine/boardlib.c   12 Jun 2005 09:34:13 -0000      1.7
+++ engine/boardlib.c   25 Sep 2005 22:38:40 -0000
@@ -41,7 +41,7 @@ int          move_history_color[MAX_MOVE
 int          move_history_pos[MAX_MOVE_HISTORY];
 int          move_history_pointer;
 
-float komi;
+float komi = 0.0;
 int movenum;
 int allow_suicide = 0;  /* allow opponent to make suicide moves */
 
Index: engine/globals.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/globals.c,v
retrieving revision 1.73
diff -u -p -r1.73 globals.c
--- engine/globals.c    12 Jun 2005 09:34:14 -0000      1.73
+++ engine/globals.c    25 Sep 2005 22:38:40 -0000
@@ -61,20 +61,21 @@ int connect_depth;  /* Used by Tristan Ca
 int connect_depth2;     /* Used by alternater connection reader. */
 int connection_node_limit; 
 int breakin_node_limit; /* Reading limits for break_in/block_off reading */
-int breakin_depth;
-int mandated_depth;             /* deep reading cut off, mandated value */
-int mandated_backfill_depth;    /* deep reading cut off, mandated value */
-int mandated_backfill2_depth;   /* deep reading cut off, mandated value */
-int mandated_break_chain_depth; /* deep reading cut off, mandated value */
-int mandated_superstring_depth; /* deep reading cut off, mandated value */
-int mandated_fourlib_depth;     /* deep reading cut off, mandated value */
-int mandated_ko_depth;          /* deep reading cut off, mandated value */
-int mandated_branch_depth;      /* deep reading cut off, mandated value */
-int mandated_aa_depth;
-int mandated_owl_distrust_depth;  
-int mandated_owl_branch_depth;  
-int mandated_owl_reading_depth; 
-int mandated_owl_node_limit;    
+int breakin_depth;    
+/* Mandated values for deep reading cutoffs. */
+int mandated_depth = -1;   
+int mandated_backfill_depth = -1;
+int mandated_backfill2_depth = -1;
+int mandated_break_chain_depth = -1;
+int mandated_superstring_depth = -1;
+int mandated_fourlib_depth = -1;   
+int mandated_ko_depth = -1;       
+int mandated_branch_depth = -1;  
+int mandated_aa_depth = -1;
+int mandated_owl_distrust_depth = -1;  
+int mandated_owl_branch_depth = -1;  
+int mandated_owl_reading_depth = -1; 
+int mandated_owl_node_limit = -1;    
 
 
 /* Miscellaneous. */
@@ -105,7 +106,7 @@ int disable_threat_computation = 0;
 int disable_endgame_patterns   = 0;
 int doing_scoring              = 0;
 
-int chinese_rules       = 0;    /* ruleset choice for GMP connection */
+int chinese_rules = CHINESE_RULES; /* ruleset choice for GMP connection */
 /* use experimental connection module */
 int experimental_connections = EXPERIMENTAL_CONNECTIONS;
 /* use alternate connection reading algorithm */
@@ -118,11 +119,12 @@ int experimental_owl_ext = EXPERIMENTAL_
 int experimental_break_in = USE_BREAK_IN;
 /* use central oriented influence */
 int cosmic_gnugo = COSMIC_GNUGO;
+/* search for large scale owl moves */
+int large_scale = LARGE_SCALE;
 
 int capture_all_dead    = 0;    /* capture all dead opponent stones */
 int play_out_aftermath  = 0;    /* make everything unconditionally settled */
-int resign_allowed      = 0;    /* resign hopeless games */
-int large_scale         = 0;    /* search for large scale owl moves */
+int resign_allowed = RESIGNATION_ALLOWED; /* resign hopeless games */
 
 int play_mirror_go      = 0;    /* try to play mirror go if possible */
 int mirror_stones_limit = -1;   /* but stop at this number of stones */
Index: interface/main.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v
retrieving revision 1.114
diff -u -p -r1.114 main.c
--- interface/main.c    12 Jun 2005 09:34:14 -0000      1.114
+++ interface/main.c    25 Sep 2005 22:38:41 -0000
@@ -343,49 +343,6 @@ main(int argc, char *argv[])
   int seed = 0;
   int seed_specified = 0;
 
-  komi = 0.0;
-  
-  level = DEFAULT_LEVEL;
-  min_level = 0;
-  max_level = 10;
-  
-  mandated_depth               = -1;
-  mandated_backfill_depth      = -1;
-  mandated_backfill2_depth     = -1;
-  mandated_break_chain_depth   = -1;
-  mandated_superstring_depth   = -1;
-  mandated_fourlib_depth       = -1;
-  mandated_ko_depth            = -1;
-  mandated_branch_depth        = -1;
-  mandated_owl_distrust_depth  = -1;
-  mandated_owl_branch_depth    = -1;
-  mandated_owl_reading_depth   = -1;
-  mandated_owl_node_limit      = -1;
-  mandated_aa_depth            = -1;
-
-  debug = 0;
-  fusekidb = 1;
-  disable_fuseki = 0;
-  josekidb = 1;
-  if (CHINESE_RULES)
-    chinese_rules = 1;
-  else 
-    chinese_rules = 0;
-  if (OWL_THREATS)
-    owl_threats = 1;
-  else
-    owl_threats = 0;
-  experimental_owl_ext = EXPERIMENTAL_OWL_EXT;
-  experimental_connections = EXPERIMENTAL_CONNECTIONS;
-  cosmic_gnugo = COSMIC_GNUGO;
-  large_scale = LARGE_SCALE;
-  resign_allowed = RESIGNATION_ALLOWED;
-
-  allow_suicide = 0;
-  capture_all_dead = 0;
-  play_out_aftermath = 0;
-  limit_search = 0;
-
   /* Default parameters for clock and auto level systems. */
   clock_init(3600, 0, 0);      /* One hour sudden death. */
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]