Built framework to allow ANSI mode to coexist with ASCII mode.
[sgk-go] / interface / main.c
index 7435dff..c6502c1 100644 (file)
@@ -24,6 +24,7 @@
 #include "gnugo.h"
 
 #include <ctype.h>
 #include "gnugo.h"
 
 #include <ctype.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -169,6 +170,8 @@ enum { OPT_BOARDSIZE = 127,
 enum mode {
     MODE_UNKNOWN = 0,
     MODE_ASCII,
 enum mode {
     MODE_UNKNOWN = 0,
     MODE_ASCII,
+    MODE_ANSI,
+    MODE_STRICTANSI,
     MODE_GTP,
     MODE_GMP,
     MODE_SGMP,
     MODE_GTP,
     MODE_GMP,
     MODE_SGMP,
@@ -703,6 +706,10 @@ int main(int argc, char* argv[])
         case OPT_MODE:
             if (strcmp(gg_optarg, "ascii") == 0)
                 playmode = MODE_ASCII;
         case OPT_MODE:
             if (strcmp(gg_optarg, "ascii") == 0)
                 playmode = MODE_ASCII;
+            else if (strcmp(gg_optarg, "ansi") == 0)
+                playmode = MODE_ANSI;
+            else if (strcmp(gg_optarg, "strictansi") == 0)
+                playmode = MODE_STRICTANSI;
             else if (strcmp(gg_optarg, "gtp") == 0)
                 playmode = MODE_GTP;
             else if (strcmp(gg_optarg, "gmp") == 0)
             else if (strcmp(gg_optarg, "gtp") == 0)
                 playmode = MODE_GTP;
             else if (strcmp(gg_optarg, "gmp") == 0)
@@ -1087,7 +1094,7 @@ int main(int argc, char* argv[])
         if (infilename)
             playmode = MODE_LOAD_AND_ANALYZE;
         else
         if (infilename)
             playmode = MODE_LOAD_AND_ANALYZE;
         else
-            playmode = (isatty(0)) ? MODE_ASCII : MODE_GMP;
+            playmode = (isatty(0)) ? MODE_ANSI : MODE_GMP;
     }
 
     if (outfile && playmode != MODE_LOAD_AND_PRINT) {
     }
 
     if (outfile && playmode != MODE_LOAD_AND_PRINT) {
@@ -1435,6 +1442,28 @@ int main(int argc, char* argv[])
 
     break;
 
 
     break;
 
+    case MODE_STRICTANSI:
+        if (mandated_color != EMPTY) gameinfo.computer_player = OTHER_COLOR(mandated_color);
+#if ORACLE
+        if (metamachine) {
+            summon_oracle();
+            oracle_loadsgf(infilename, untilstring);
+        }
+#endif
+        play_ansi(&sgftree, &gameinfo, infilename, untilstring, true);
+        break;
+
+    case MODE_ANSI:
+        if (mandated_color != EMPTY) gameinfo.computer_player = OTHER_COLOR(mandated_color);
+#if ORACLE
+        if (metamachine) {
+            summon_oracle();
+            oracle_loadsgf(infilename, untilstring);
+        }
+#endif
+        play_ansi(&sgftree, &gameinfo, infilename, untilstring, false);
+        break;
+
     case MODE_ASCII:
     default:
         if (mandated_color != EMPTY)
     case MODE_ASCII:
     default:
         if (mandated_color != EMPTY)
@@ -1442,8 +1471,8 @@ int main(int argc, char* argv[])
 
         /* Display copyright message in ASCII mode unless --quiet option used. */
         if (!quiet) {
 
         /* Display copyright message in ASCII mode unless --quiet option used. */
         if (!quiet) {
-            show_version();
-            show_copyright();
+             show_version();
+             show_copyright();
         }
 
 #if ORACLE
         }
 
 #if ORACLE
@@ -1468,7 +1497,7 @@ int main(int argc, char* argv[])
 static void
 show_version(void)
 {
 static void
 show_version(void)
 {
-    printf("GNU Go %s\n", VERSION);
+    printf("GNU Go %s\n with SGK modifications", VERSION);
 }
 
 /* Set the parameters which determine the depth to which
 }
 
 /* Set the parameters which determine the depth to which