Upgrade to Bonanza 6.0
[bonanza.git] / main.c
diff --git a/main.c b/main.c
index f84ad15..1591760 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,36 +1,3 @@
-/*
-  BUG LIST                                                       
-
-  - detection of repetitions can be wrong due to collision of hash keys and
-    limitation of history table size.
-
-  - detection of mates fails if all of pseudo-legal evasions are perpetual
-    checks.  Father more, inferior evasions, such as unpromotion of
-    bishop, rook, and lance at 8th rank, are not counted for the mate
-    detection. 
-
-  - detection of perpetual checks fails if one of those inferior
-    evasions makes a position that occurred four times.
-*/
-/*
-  TODO:
-  - idirec && is_pinned_on_black_king();
-  - aifile and airank
-  - incheck at quies
-  - max legal moves
-  - tactical macro
-  - out_warning( "A node returns a value lower than mate." ); is obsolate.
-  - do_mate in hash
-  - pv store to hash
-  - no threat
-  - use IsDiscover macro
-  - change hash_store_pv()
-  - dek.c is obsolate.
-  - limit time ? ? num
-  - hash.bin
-  - SHARE to all transition table
- */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -41,8 +8,8 @@
 
 static int main_child( tree_t * restrict ptree );
 
-int CONV_CDECL
-#if defined(CSASHOGI)
+int
+#if defined(CSASHOGI) || defined(USI)
 main( int argc, char *argv[] )
 #else
 main()
@@ -58,7 +25,6 @@ main()
 #endif
 
 #if defined(CSASHOGI) && defined(_WIN32)
-  FreeConsole();
   if ( argc != 2 || strcmp( argv[1], "csa_shogi" ) )
     {
       MessageBox( NULL,
@@ -70,6 +36,11 @@ main()
     }
 #endif
 
+#if defined(USI)
+  if ( argc == 2 && ! strcmp( argv[1], "usi" ) ) { usi_mode = usi_on; }
+  else                                           { usi_mode = usi_off; }
+#endif
+
   if ( ini( ptree ) < 0 )
     {
       out_error( "%s", str_error );
@@ -82,13 +53,13 @@ main()
       if ( iret == -1 )
        {
          out_error( "%s", str_error );
-         ShutdownClient;
+         ShutdownAll();
          break;
        }
       else if ( iret == -2 )
        {
          out_warning( "%s", str_error );
-         ShutdownClient;
+         ShutdownAll();
          continue;
        }
       else if ( iret == -3 ) { break; }
@@ -105,18 +76,6 @@ main_child( tree_t * restrict ptree )
 {
   int iret;
 
-#if defined(DEKUNOBOU)
-  if ( dek_ngame && ( game_status & mask_game_end ) )
-    {
-      TlpEnd();
-      if ( dek_next_game( ptree ) < 0 )
-       {
-         out_error( "%s", str_error );
-         return -3;
-       }
-    }
-#endif
-
   /* ponder a move */
   ponder_move = 0;
   iret = ponder( ptree );