gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] gtp-initial-orientation option for gnugo


From: Teun Burgers
Subject: [gnugo-devel] gtp-initial-orientation option for gnugo
Date: Tue, 16 Oct 2001 22:55:33 +0200

This patch implements a command line option with which
the initial orientation for gtp mode can be set

Teun
Index: interface.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/interface.h,v
retrieving revision 1.5
diff -u -r1.5 interface.h
--- interface.h 2001/09/06 21:39:52     1.5
+++ interface.h 2001/10/16 20:51:38
@@ -39,7 +39,7 @@
                char *filename, char *until);
 void play_ascii_emacs(SGFTree *tree, Gameinfo *gameinfo, 
                      char *filename, char *until);
-void play_gtp(FILE *gtp_input);
+void play_gtp(FILE *gtp_input, int gtp_initial_orientation);
 void play_gmp(int boardsize, Gameinfo *gameinfo);
 void play_solo(Gameinfo *gameinfo, int benchmark);
 void play_replay(SGFNode *sgf_head, int color_to_test);
Index: main.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/main.c,v
retrieving revision 1.10
diff -u -r1.10 main.c
--- main.c      2001/10/11 15:39:37     1.10
+++ main.c      2001/10/16 20:51:44
@@ -77,6 +77,7 @@
       OPT_OUTFILE, 
       OPT_QUIET,
       OPT_GTP_INPUT,
+      OPT_GTP_INITIAL_ORIENTATION,
       OPT_SHOWCOPYRIGHT,
       OPT_REPLAY_GAME,
       OPT_DECIDE_STRING,
@@ -149,6 +150,8 @@
   {"quiet",          no_argument,       0, OPT_QUIET},
   {"silent",         no_argument,       0, OPT_QUIET},
   {"gtp-input",      required_argument, 0, OPT_GTP_INPUT},
+  {"gtp-initial-orientation",
+                    required_argument, 0, OPT_GTP_INITIAL_ORIENTATION},
   {"infile",         required_argument, 0, 'l'},
   {"until",          required_argument, 0, 'L'},
   {"outfile",        required_argument, 0, 'o'},
@@ -243,6 +246,7 @@
   int benchmark = 0;  /* benchmarking mode (-b) */
   float komi = 0.0;
   FILE *gtp_input_FILE;
+  int gtp_initial_orientation = 0;
   
   int seed = 0;      /* If seed is zero, GNU Go will play a different game 
                        each time. If it is set using -r, GNU Go will play the
@@ -342,6 +346,16 @@
        gtpfile = gg_optarg;
        break;
        
+      case OPT_GTP_INITIAL_ORIENTATION:
+       gtp_initial_orientation = atoi(gg_optarg);
+       if (gtp_initial_orientation < 0 || gtp_initial_orientation > 7) {
+         fprintf(stderr, "Illegal orientation: %d.\n",
+                  gtp_initial_orientation);
+         fprintf(stderr, "Try `gnugo --help' for more information.\n");
+         exit(EXIT_FAILURE);
+       }
+       break;
+       
       case OPT_SHOWTIME:
        showtime = 1;
        break;
@@ -910,7 +924,7 @@
     else
       gtp_input_FILE = stdin;
 
-    play_gtp(gtp_input_FILE);
+    play_gtp(gtp_input_FILE, gtp_initial_orientation);
     break;
 
   case MODE_ASCII_EMACS:  
Index: play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.34
diff -u -r1.34 play_gtp.c
--- play_gtp.c  2001/10/16 19:53:01     1.34
+++ play_gtp.c  2001/10/16 20:51:49
@@ -223,7 +223,7 @@
 
 /* Start playing using the Go Text Protocol. */
 void
-play_gtp(FILE *gtp_input)
+play_gtp(FILE *gtp_input, int gtp_initial_orientation)
 {
   /* Try to make sure that we have a useful level of buffering of stdout. */
 #ifdef HAVE_SETLINEBUF
@@ -235,6 +235,7 @@
   /* Inform the GTP utility functions about the board size. */
   board_size = 19;
   gtp_internal_set_boardsize(19);
+  gtp_orientation = gtp_initial_orientation;
   
   /* Prepare pattern matcher and reading code. */
   reset_engine();

reply via email to

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