Adjust comment to prevent licensecheck from considering pattern.c as generated
[gnushogi.git] / gnushogi / genmove.c
index 4c20a5f..9034b65 100644 (file)
@@ -2,11 +2,14 @@
  * FILE: genmove.c
  *
  * ----------------------------------------------------------------------
- *
- * Copyright (c) 2012 Free Software Foundation
+ * Copyright (c) 1993, 1994, 1995 Matthias Mutz
+ * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
  *
  * GNU SHOGI is based on GNU CHESS
  *
+ * Copyright (c) 1988, 1989, 1990 John Stanback
+ * Copyright (c) 1992 Free Software Foundation
+ *
  * This file is part of GNU SHOGI.
  *
  * GNU Shogi is free software; you can redistribute it and/or modify it
@@ -310,12 +313,12 @@ PromotionPossible(short color, short f, short t, short p)
 {
     if (color == black)
     {
-        if ((f < 54) && (t < 54))
+       if ((!InWhiteCamp(f)) && (!InWhiteCamp(t)))
             return false;
     }
     else
     {
-        if ((f > 26) && (t > 26))
+       if ((!InBlackCamp(f)) && (!InBlackCamp(t)))
             return false;
     }
 
@@ -323,8 +326,10 @@ PromotionPossible(short color, short f, short t, short p)
     switch (p)
     {
     case pawn:
+#ifndef MINISHOGI
     case lance:
     case knight:
+#endif
     case silver:
     case bishop:
     case rook:
@@ -355,6 +360,7 @@ NonPromotionPossible(short color, short f,
                     : (generate_move_flags ? ILLEGAL_TRAPPED : false));
         }
 
+#ifndef MINISHOGI
     case lance:
         if (color == black)
         {
@@ -382,6 +388,7 @@ NonPromotionPossible(short color, short f,
                     ? true
                     : (generate_move_flags ? ILLEGAL_TRAPPED : false));
         }
+#endif
     }
 
     return true;
@@ -530,7 +537,11 @@ field_bonus(short ply, short side, short piece,
 
                     /* CHECKME: is this right? */
                     if (((rvupiece == rvuboard) && (upiece == pawn))
-                        || (upiece == bishop) || (upiece == knight))
+                        || (upiece == bishop)
+#ifndef MINISHOGI
+                       || (upiece == knight)
+#endif
+                       )
                     {
                         s++; /* The opposing pawn (piece) */
 
@@ -769,7 +780,11 @@ LinkMove(short ply, short f,
             {
 #ifdef TESUJIBONUS
                 /* Look at non-promoting silver or knight */
-                if (piece == silver || piece == knight)
+                if (piece == silver
+#ifndef MINISHOGI
+                   || piece == knight
+#endif
+                   )
                 {
                     local_flag |= tesuji; /* Non-promotion */
                     s++;
@@ -905,6 +920,7 @@ DropPossible(short piece, short side, short sq)
             GenUnmakeMove(side, f, sq, tempb, tempc, false);
         }
     }
+#ifndef MINISHOGI
     else if (piece == lance)
     {
         if ((side == black) && (r == 8))
@@ -919,6 +935,7 @@ DropPossible(short piece, short side, short sq)
         else if ((side == white) && (r <= 1))
             possible = (generate_move_flags ? ILLEGAL_TRAPPED : false);
     }
+#endif
 
     return possible;
 }
@@ -1107,9 +1124,13 @@ LinkPreventCheckDrops(short side, short xside, short ply)
     if (board[square = PieceList[side][0]] != king)
         return;
 
-    for (piece = lance; piece <= rook; piece++)
+    for (piece = pawn+1; piece <= rook; piece++)
     {
-        if (piece == lance || piece == bishop || piece == rook)
+        if (
+#ifndef MINISHOGI
+           piece == lance ||
+#endif
+           piece == bishop || piece == rook)
         {
             /* check for threat of xside piece */
             ptyp = ptype[side][piece];
@@ -1636,7 +1657,7 @@ IsCheckmate(short side, short in_check, short blockable)
                  * Drops are restricted for pawns, lances, and knights.
                  */
 
-                if (piece > knight)
+                if (piece >= silver)
                     break;
             }
         }