]> git.sesse.net Git - stockfish/commitdiff
Big headers cleanup
authorMarco Costalba <mcostalba@gmail.com>
Wed, 18 Mar 2009 14:36:03 +0000 (15:36 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 19 Mar 2009 11:55:32 +0000 (12:55 +0100)
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
17 files changed:
src/bitboard.cpp
src/bitboard.h
src/color.h
src/direction.h
src/evaluate.h
src/lock.h
src/main.cpp
src/move.cpp
src/movegen.h
src/movepick.h
src/pawns.cpp
src/pawns.h
src/phase.h [deleted file]
src/piece.h
src/position.h
src/psqtab.h
src/timeoday.cpp

index 89b543212998155cbeb91b4f6040dd2bfaeaa541..3621d6b204ca38eb5d6f8b7021439bcbbe378ea5 100644 (file)
 #include "direction.h"
 
 
 #include "direction.h"
 
 
-////
-//// Constants and variables
-////
-
-const Bitboard SquaresByColorBB[2] = {BlackSquaresBB, WhiteSquaresBB};
-
-const Bitboard FileBB[8] = {
-  FileABB, FileBBB, FileCBB, FileDBB, FileEBB, FileFBB, FileGBB, FileHBB
-};
-
-const Bitboard NeighboringFilesBB[8] = {
-  FileBBB, FileABB|FileCBB, FileBBB|FileDBB, FileCBB|FileEBB,
-  FileDBB|FileFBB, FileEBB|FileGBB, FileFBB|FileHBB, FileGBB
-};
-
-const Bitboard ThisAndNeighboringFilesBB[8] = {
-  FileABB|FileBBB, FileABB|FileBBB|FileCBB,
-  FileBBB|FileCBB|FileDBB, FileCBB|FileDBB|FileEBB,
-  FileDBB|FileEBB|FileFBB, FileEBB|FileFBB|FileGBB,
-  FileFBB|FileGBB|FileHBB, FileGBB|FileHBB
-};
-
-const Bitboard RankBB[8] = {
-  Rank1BB, Rank2BB, Rank3BB, Rank4BB, Rank5BB, Rank6BB, Rank7BB, Rank8BB
-};
-
-const Bitboard RelativeRankBB[2][8] = {
-  {
-    Rank1BB, Rank2BB, Rank3BB, Rank4BB, Rank5BB, Rank6BB, Rank7BB, Rank8BB
-  },
-  {
-    Rank8BB, Rank7BB, Rank6BB, Rank5BB, Rank4BB, Rank3BB, Rank2BB, Rank1BB
-  }
-};
-
-const Bitboard InFrontBB[2][8] = {
-  {
-    Rank2BB | Rank3BB | Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
-    Rank3BB | Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
-    Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
-    Rank5BB | Rank6BB | Rank7BB | Rank8BB,
-    Rank6BB | Rank7BB | Rank8BB,
-    Rank7BB | Rank8BB,
-    Rank8BB,
-    EmptyBoardBB
-  },
-  {
-    EmptyBoardBB,
-    Rank1BB,
-    Rank2BB | Rank1BB,
-    Rank3BB | Rank2BB | Rank1BB,
-    Rank4BB | Rank3BB | Rank2BB | Rank1BB,
-    Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB,
-    Rank6BB | Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB,
-    Rank7BB | Rank6BB | Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB
-  }
-};
-
 #if defined(USE_COMPACT_ROOK_ATTACKS)
 
 Bitboard RankAttacks[8][64], FileAttacks[8][64];
 #if defined(USE_COMPACT_ROOK_ATTACKS)
 
 Bitboard RankAttacks[8][64], FileAttacks[8][64];
@@ -270,6 +212,7 @@ Bitboard QueenPseudoAttacks[64];
 ////
 
 namespace {
 ////
 
 namespace {
+
   void init_masks();
   void init_ray_bitboards();
   void init_attacks();
   void init_masks();
   void init_ray_bitboards();
   void init_attacks();
index 1aefd8add5a623729652f70fc21a45076aacb5ee..d1cf40f25b0e0f480f04c488babe248805d4442f 100644 (file)
@@ -84,8 +84,7 @@ const Bitboard EmptyBoardBB = 0ULL;
 
 const Bitboard WhiteSquaresBB = 0x55AA55AA55AA55AAULL;
 const Bitboard BlackSquaresBB = 0xAA55AA55AA55AA55ULL;
 
 const Bitboard WhiteSquaresBB = 0x55AA55AA55AA55AAULL;
 const Bitboard BlackSquaresBB = 0xAA55AA55AA55AA55ULL;
-
-extern const Bitboard SquaresByColorBB[2];
+const Bitboard SquaresByColorBB[2] = { BlackSquaresBB, WhiteSquaresBB };
 
 const Bitboard FileABB = 0x0101010101010101ULL;
 const Bitboard FileBBB = 0x0202020202020202ULL;
 
 const Bitboard FileABB = 0x0101010101010101ULL;
 const Bitboard FileBBB = 0x0202020202020202ULL;
@@ -96,9 +95,21 @@ const Bitboard FileFBB = 0x2020202020202020ULL;
 const Bitboard FileGBB = 0x4040404040404040ULL;
 const Bitboard FileHBB = 0x8080808080808080ULL;
 
 const Bitboard FileGBB = 0x4040404040404040ULL;
 const Bitboard FileHBB = 0x8080808080808080ULL;
 
-extern const Bitboard FileBB[8];
-extern const Bitboard NeighboringFilesBB[8];
-extern const Bitboard ThisAndNeighboringFilesBB[8];
+const Bitboard FileBB[8] = {
+  FileABB, FileBBB, FileCBB, FileDBB, FileEBB, FileFBB, FileGBB, FileHBB
+};
+
+const Bitboard NeighboringFilesBB[8] = {
+  FileBBB, FileABB|FileCBB, FileBBB|FileDBB, FileCBB|FileEBB,
+  FileDBB|FileFBB, FileEBB|FileGBB, FileFBB|FileHBB, FileGBB
+};
+
+const Bitboard ThisAndNeighboringFilesBB[8] = {
+  FileABB|FileBBB, FileABB|FileBBB|FileCBB,
+  FileBBB|FileCBB|FileDBB, FileCBB|FileDBB|FileEBB,
+  FileDBB|FileEBB|FileFBB, FileEBB|FileFBB|FileGBB,
+  FileFBB|FileGBB|FileHBB, FileGBB|FileHBB
+};
 
 const Bitboard Rank1BB = 0xFFULL;
 const Bitboard Rank2BB = 0xFF00ULL;
 
 const Bitboard Rank1BB = 0xFFULL;
 const Bitboard Rank2BB = 0xFF00ULL;
@@ -109,9 +120,35 @@ const Bitboard Rank6BB = 0xFF0000000000ULL;
 const Bitboard Rank7BB = 0xFF000000000000ULL;
 const Bitboard Rank8BB = 0xFF00000000000000ULL;
 
 const Bitboard Rank7BB = 0xFF000000000000ULL;
 const Bitboard Rank8BB = 0xFF00000000000000ULL;
 
-extern const Bitboard RankBB[8];
-extern const Bitboard RelativeRankBB[2][8];
-extern const Bitboard InFrontBB[2][8];
+const Bitboard RankBB[8] = {
+  Rank1BB, Rank2BB, Rank3BB, Rank4BB, Rank5BB, Rank6BB, Rank7BB, Rank8BB
+};
+
+const Bitboard RelativeRankBB[2][8] = {
+  { Rank1BB, Rank2BB, Rank3BB, Rank4BB, Rank5BB, Rank6BB, Rank7BB, Rank8BB },
+  { Rank8BB, Rank7BB, Rank6BB, Rank5BB, Rank4BB, Rank3BB, Rank2BB, Rank1BB }
+};
+
+const Bitboard InFrontBB[2][8] = {
+  { Rank2BB | Rank3BB | Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank3BB | Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank6BB | Rank7BB | Rank8BB,
+    Rank7BB | Rank8BB,
+    Rank8BB,
+    EmptyBoardBB
+  },
+  { EmptyBoardBB,
+    Rank1BB,
+    Rank2BB | Rank1BB,
+    Rank3BB | Rank2BB | Rank1BB,
+    Rank4BB | Rank3BB | Rank2BB | Rank1BB,
+    Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB,
+    Rank6BB | Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB,
+    Rank7BB | Rank6BB | Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB
+  }
+};
 
 extern Bitboard SetMaskBB[65];
 extern Bitboard ClearMaskBB[65];
 
 extern Bitboard SetMaskBB[65];
 extern Bitboard ClearMaskBB[65];
@@ -124,13 +161,17 @@ extern Bitboard PassedPawnMask[2][64];
 extern Bitboard OutpostMask[2][64];
 
 #if defined(USE_COMPACT_ROOK_ATTACKS)
 extern Bitboard OutpostMask[2][64];
 
 #if defined(USE_COMPACT_ROOK_ATTACKS)
+
 extern Bitboard RankAttacks[8][64], FileAttacks[8][64];
 extern Bitboard RankAttacks[8][64], FileAttacks[8][64];
+
 #else
 #else
+
 extern const uint64_t RMult[64];
 extern const int RShift[64];
 extern Bitboard RMask[64];
 extern int RAttackIndex[64];
 extern Bitboard RAttacks[0x19000];
 extern const uint64_t RMult[64];
 extern const int RShift[64];
 extern Bitboard RMask[64];
 extern int RAttackIndex[64];
 extern Bitboard RAttacks[0x19000];
+
 #endif // defined(USE_COMPACT_ROOK_ATTACKS)
 
 extern const uint64_t BMult[64];
 #endif // defined(USE_COMPACT_ROOK_ATTACKS)
 
 extern const uint64_t BMult[64];
@@ -212,7 +253,7 @@ inline Bitboard this_and_neighboring_files_bb(Square s) {
 
 /// relative_rank_bb() takes a color and a rank as input, and returns a bitboard
 /// representing all squares on the given rank from the given color's point of
 
 /// relative_rank_bb() takes a color and a rank as input, and returns a bitboard
 /// representing all squares on the given rank from the given color's point of
-/// view.  For instance, relative_rank_bb(WHITE, 7) gives all squares on the
+/// view. For instance, relative_rank_bb(WHITE, 7) gives all squares on the
 /// 7th rank, while relative_rank_bb(BLACK, 7) gives all squares on the 2nd
 /// rank.
 
 /// 7th rank, while relative_rank_bb(BLACK, 7) gives all squares on the 2nd
 /// rank.
 
index 81ba55c16784b2be679cbd78b6b484a83e6ca901..872c7b79548dce4524e1b35bfb49cf678356dbc8 100644 (file)
 #if !defined(COLOR_H_INCLUDED)
 #define COLOR_H_INCLUDED
 
 #if !defined(COLOR_H_INCLUDED)
 #define COLOR_H_INCLUDED
 
-////
-//// Includes
-////
-
-#include "misc.h"
-
 
 ////
 //// Types
 
 ////
 //// Types
index 988128e390fe2d06505f89a8611a5ab4fe0941f1..4ca264a0291ae5ed59deb21a7170444fcadab32b 100644 (file)
@@ -38,8 +38,8 @@ enum Direction {
 };
 
 enum SignedDirection {
 };
 
 enum SignedDirection {
-  SIGNED_DIR_E = 0, SIGNED_DIR_W = 1,
-  SIGNED_DIR_N = 2, SIGNED_DIR_S = 3,
+  SIGNED_DIR_E  = 0, SIGNED_DIR_W  = 1,
+  SIGNED_DIR_N  = 2, SIGNED_DIR_S  = 3,
   SIGNED_DIR_NE = 4, SIGNED_DIR_SW = 5,
   SIGNED_DIR_NW = 6, SIGNED_DIR_SE = 7,
   SIGNED_DIR_NONE = 8
   SIGNED_DIR_NE = 4, SIGNED_DIR_SW = 5,
   SIGNED_DIR_NW = 6, SIGNED_DIR_SE = 7,
   SIGNED_DIR_NONE = 8
@@ -58,9 +58,11 @@ extern uint8_t SignedDirectionTable[64][64];
 //// Inline functions
 ////
 
 //// Inline functions
 ////
 
-inline void operator++ (Direction &d, int) { d = Direction(int(d) + 1); }
+inline void operator++ (Direction& d, int) {
+  d = Direction(int(d) + 1);
+}
 
 
-inline void operator++ (SignedDirection &d, int) {
+inline void operator++ (SignedDirectiond, int) {
   d = SignedDirection(int(d) + 1);
 }
 
   d = SignedDirection(int(d) + 1);
 }
 
index b95aa15d92aad4e662f90a1cc8f2f8d52fced5f1..fd0c27803ef4537be4ea0c87fd765c11a6eb8bfd 100644 (file)
 
 #include "material.h"
 #include "pawns.h"
 
 #include "material.h"
 #include "pawns.h"
-#include "position.h"
 
 
 ////
 //// Types
 ////
 
 
 
 ////
 //// Types
 ////
 
+
 /// The EvalInfo struct contains various information computed and collected
 /// The EvalInfo struct contains various information computed and collected
-/// by the evaluation function.  An EvalInfo object is passed as one of the
+/// by the evaluation function. An EvalInfo object is passed as one of the
 /// arguments to the evaluation function, and the search can make use of its
 /// contents to make intelligent search decisions.
 ///
 /// At the moment, this is not utilized very much:  The only part of the
 /// EvalInfo object which is used by the search is futilityMargin.
 /// arguments to the evaluation function, and the search can make use of its
 /// contents to make intelligent search decisions.
 ///
 /// At the moment, this is not utilized very much:  The only part of the
 /// EvalInfo object which is used by the search is futilityMargin.
+class Position;
 
 struct EvalInfo {
 
 
 struct EvalInfo {
 
-  // Middle game and endgame evaluations:
+  // Middle game and endgame evaluations
   Value mgValue, egValue;
 
   Value mgValue, egValue;
 
-  // Pointers to material and pawn hash table entries:
-  MaterialInfo *mi;
-  PawnInfo *pi;
+  // Pointers to material and pawn hash table entries
+  MaterialInfomi;
+  PawnInfopi;
 
   // attackedBy[color][piece type] is a bitboard representing all squares
   // attacked by a given color and piece type.  attackedBy[color][0] contains
 
   // attackedBy[color][piece type] is a bitboard representing all squares
   // attacked by a given color and piece type.  attackedBy[color][0] contains
@@ -100,8 +101,8 @@ struct EvalInfo {
 //// Prototypes
 ////
 
 //// Prototypes
 ////
 
-extern Value evaluate(const Position &pos, EvalInfo &ei, int threadID);
-extern Value quick_evaluate(const Position &pos);
+extern Value evaluate(const Position& pos, EvalInfo& ei, int threadID);
+extern Value quick_evaluate(const Positionpos);
 extern void init_eval(int threads);
 extern void quit_eval();
 extern void read_weights(Color sideToMove);
 extern void init_eval(int threads);
 extern void quit_eval();
 extern void read_weights(Color sideToMove);
index b34957df8c1f9cb0d7c149806507ced0024a74c5..d813397e513777d76a535cac9177c53bb3513724 100644 (file)
@@ -87,7 +87,7 @@ typedef pthread_mutex_t Lock;
 #else
 
 
 #else
 
 
-#  include <windows.h>
+#include <windows.h>
 
 typedef CRITICAL_SECTION Lock;
 #  define lock_init(x, y) InitializeCriticalSection(x)
 
 typedef CRITICAL_SECTION Lock;
 #  define lock_init(x, y) InitializeCriticalSection(x)
index e01599db8e9893f80cc3b3143cb8f6063bbe8bc1..ac466597d9500c3ab4531212535d939ddc355ef9 100644 (file)
@@ -52,7 +52,6 @@ int main(int argc, char *argv[]) {
   std::cin.rdbuf()->pubsetbuf(NULL, 0);
 
   // Initialization
   std::cin.rdbuf()->pubsetbuf(NULL, 0);
 
   // Initialization
-
   init_mersenne();
   init_direction_table();
   init_bitboards();
   init_mersenne();
   init_direction_table();
   init_bitboards();
@@ -73,7 +72,7 @@ int main(int argc, char *argv[]) {
   {
       if (argc < 4 || argc > 7)
       {
   {
       if (argc < 4 || argc > 7)
       {
-        std::cout << "Usage: glaurung bench <hash size> <threads> "
+        std::cout << "Usage: stockfish bench <hash size> <threads> "
                   << "[time = 60s] [fen positions file = default] "
                   << "[time, depth or node limited = time]"
                   << std::endl;
                   << "[time = 60s] [fen positions file = default] "
                   << "[time, depth or node limited = time]"
                   << std::endl;
index ad282dfb56da9104d15bbce3b2eae91d2ab09c97..3935eb3458516fdb62851bcc0f771fc62f099e40 100644 (file)
@@ -139,7 +139,7 @@ const std::string move_to_string(Move move) {
 
 /// Overload the << operator, to make it easier to print moves.
 
 
 /// Overload the << operator, to make it easier to print moves.
 
-std::ostream &operator << (std::ostream &os, Move m) {
+std::ostream &operator << (std::ostreamos, Move m) {
 
   return os << move_to_string(m);
 }
 
   return os << move_to_string(m);
 }
index 48e0dec032ca848ec00118c82d9719fd7c1a8968..18715683ec309330ca66b6eeb449415df93662ec 100644 (file)
 //// Prototypes
 ////
 
 //// Prototypes
 ////
 
-extern int generate_captures(const Position &pos, MoveStack *mlist);
-extern int generate_noncaptures(const Position &pos, MoveStack *mlist);
-extern int generate_checks(const Position &pos, MoveStack *mlist, Bitboard dc);
-extern int generate_evasions(const Position &pos, MoveStack *mlist, Bitboard pinned);
-extern int generate_legal_moves(const Position &pos, MoveStack *mlist);
-extern bool move_is_legal(const Position &pos, const Move m, Bitboard pinned);
+extern int generate_captures(const Position& pos, MoveStack* mlist);
+extern int generate_noncaptures(const Position& pos, MoveStack* mlist);
+extern int generate_checks(const Position& pos, MoveStack* mlist, Bitboard dc);
+extern int generate_evasions(const Position& pos, MoveStack* mlist, Bitboard pinned);
+extern int generate_legal_moves(const Position& pos, MoveStack* mlist);
+extern bool move_is_legal(const Positionpos, const Move m, Bitboard pinned);
 
 
 #endif // !defined(MOVEGEN_H_INCLUDED)
 
 
 #endif // !defined(MOVEGEN_H_INCLUDED)
index 2c861c71db873377800dca30e2e3d82096739dd2..135b3555d2b90ae03d272659e2bdf1dbe29e1ef7 100644 (file)
@@ -105,7 +105,6 @@ private:
 /// a single reply to check.
 
 inline int MovePicker::number_of_moves() const {
 /// a single reply to check.
 
 inline int MovePicker::number_of_moves() const {
-
   return numOfMoves;
 }
 
   return numOfMoves;
 }
 
index 0aacec0026544b9f768fcd33641d09e7c38fb31e..8dfb75a9d40692aaffb769895548a58c1b272556 100644 (file)
@@ -26,6 +26,7 @@
 #include <cstring>
 
 #include "pawns.h"
 #include <cstring>
 
 #include "pawns.h"
+#include "position.h"
 
 
 ////
 
 
 ////
index 4b61d80ecf4a7929c39145e13bdd830937c58aee..bd6b54abb3ddfc75f3d2e87c2247aeb9648d74c3 100644 (file)
@@ -25,8 +25,8 @@
 //// Includes
 ////
 
 //// Includes
 ////
 
-#include "position.h"
-
+#include "bitboard.h"
+#include "value.h"
 
 ////
 //// Types
 
 ////
 //// Types
@@ -38,6 +38,7 @@
 /// to add further information in the future.  A lookup to the pawn hash table
 /// (performed by calling the get_pawn_info method in a PawnInfoTable object)
 /// returns a pointer to a PawnInfo object.
 /// to add further information in the future.  A lookup to the pawn hash table
 /// (performed by calling the get_pawn_info method in a PawnInfoTable object)
 /// returns a pointer to a PawnInfo object.
+class Position;
 
 class PawnInfo {
 
 
 class PawnInfo {
 
@@ -49,9 +50,9 @@ public:
   Value kingside_storm_value(Color c) const;
   Value queenside_storm_value(Color c) const;
   Bitboard passed_pawns() const;
   Value kingside_storm_value(Color c) const;
   Value queenside_storm_value(Color c) const;
   Bitboard passed_pawns() const;
-  bool file_is_half_open(Color c, File f) const;
-  bool has_open_file_to_left(Color c, File f) const;
-  bool has_open_file_to_right(Color c, File f) const;
+  int file_is_half_open(Color c, File f) const;
+  int has_open_file_to_left(Color c, File f) const;
+  int has_open_file_to_right(Color c, File f) const;
 
 private:
   void clear();
 
 private:
   void clear();
@@ -75,11 +76,11 @@ public:
   PawnInfoTable(unsigned numOfEntries);
   ~PawnInfoTable();
   void clear();
   PawnInfoTable(unsigned numOfEntries);
   ~PawnInfoTable();
   void clear();
-  PawnInfo *get_pawn_info(const Position &pos);
+  PawnInfo* get_pawn_info(const Position& pos);
 
 private:
   unsigned size;
 
 private:
   unsigned size;
-  PawnInfo *entries;
+  PawnInfoentries;
 };
 
 
 };
 
 
@@ -107,15 +108,15 @@ inline Value PawnInfo::queenside_storm_value(Color c) const {
   return Value(qsStormValue[c]);
 }
 
   return Value(qsStormValue[c]);
 }
 
-inline bool PawnInfo::file_is_half_open(Color c, File f) const {
+inline int PawnInfo::file_is_half_open(Color c, File f) const {
   return (halfOpenFiles[c] & (1 << int(f)));
 }
 
   return (halfOpenFiles[c] & (1 << int(f)));
 }
 
-inline bool PawnInfo::has_open_file_to_left(Color c, File f) const {
+inline int PawnInfo::has_open_file_to_left(Color c, File f) const {
   return halfOpenFiles[c] & ((1 << int(f)) - 1);
 }
 
   return halfOpenFiles[c] & ((1 << int(f)) - 1);
 }
 
-inline bool PawnInfo::has_open_file_to_right(Color c, File f) const {
+inline int PawnInfo::has_open_file_to_right(Color c, File f) const {
   return halfOpenFiles[c] & ~((1 << int(f+1)) - 1);
 }
 
   return halfOpenFiles[c] & ~((1 << int(f+1)) - 1);
 }
 
diff --git a/src/phase.h b/src/phase.h
deleted file mode 100644 (file)
index 29981be..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-  Stockfish, a UCI chess playing engine derived from Glaurung 2.1
-  Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
-  Copyright (C) 2008 Marco Costalba
-
-  Stockfish is free software: you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation, either version 3 of the License, or
-  (at your option) any later version.
-
-  Stockfish is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
-#if !defined(PHASE_H_INCLUDED)
-#define PHASE_H_INCLUDED
-
-////
-//// Types
-////
-
-enum Phase {
-  PHASE_ENDGAME = 0,
-  PHASE_MIDGAME = 128
-};
-
-
-#endif // !defined(PHASE_H_INCLUDED)
index be75a433867cd4e672e5a7013833f65ba8a03499..cf23c0288c2e79dc25bf6cdc6da720f858011532 100644 (file)
@@ -26,7 +26,6 @@
 ////
 
 #include "color.h"
 ////
 
 #include "color.h"
-#include "misc.h"
 #include "square.h"
 
 
 #include "square.h"
 
 
@@ -50,41 +49,10 @@ enum Piece {
 //// Constants
 ////
 
 //// Constants
 ////
 
-const PieceType PieceTypeMin = PAWN;
-const PieceType PieceTypeMax = KING;
-
 const int SlidingArray[18] = {
   0, 0, 0, 1, 2, 3, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0, 0
 };
 
 const int SlidingArray[18] = {
   0, 0, 0, 1, 2, 3, 0, 0, 0, 0, 0, 1, 2, 3, 0, 0, 0, 0
 };
 
-const SquareDelta Directions[16][16] = {
-  {DELTA_ZERO},
-  {DELTA_NW, DELTA_NE, DELTA_ZERO},
-  {DELTA_SSW, DELTA_SSE, DELTA_SWW, DELTA_SEE,
-   DELTA_NWW, DELTA_NEE, DELTA_NNW, DELTA_NNE, DELTA_ZERO},
-  {DELTA_SE, DELTA_SW, DELTA_NE, DELTA_NW, DELTA_ZERO},
-  {DELTA_S, DELTA_E, DELTA_W, DELTA_N, DELTA_ZERO},
-  {DELTA_S, DELTA_E, DELTA_W, DELTA_N,
-   DELTA_SE, DELTA_SW, DELTA_NE, DELTA_NW, DELTA_ZERO},
-  {DELTA_S, DELTA_E, DELTA_W, DELTA_N,
-   DELTA_SE, DELTA_SW, DELTA_NE, DELTA_NW, DELTA_ZERO},
-  {DELTA_ZERO},
-  {DELTA_ZERO},
-  {DELTA_SW, DELTA_SE, DELTA_ZERO},
-  {DELTA_SSW, DELTA_SSE, DELTA_SWW, DELTA_SEE,
-   DELTA_NWW, DELTA_NEE, DELTA_NNW, DELTA_NNE, DELTA_ZERO},
-  {DELTA_SE, DELTA_SW, DELTA_NE, DELTA_NW, DELTA_ZERO},
-  {DELTA_S, DELTA_E, DELTA_W, DELTA_N, DELTA_ZERO},
-  {DELTA_S, DELTA_E, DELTA_W, DELTA_N,
-   DELTA_SE, DELTA_SW, DELTA_NE, DELTA_NW, DELTA_ZERO},
-  {DELTA_S, DELTA_E, DELTA_W, DELTA_N,
-   DELTA_SE, DELTA_SW, DELTA_NE, DELTA_NW, DELTA_ZERO},
-};
-
-const SquareDelta PawnPush[2] = {
-  DELTA_N, DELTA_S
-};
-
 
 ////
 //// Inline functions
 
 ////
 //// Inline functions
@@ -115,12 +83,12 @@ inline int piece_is_slider(Piece p) {
   return SlidingArray[int(p)];
 }
 
   return SlidingArray[int(p)];
 }
 
-inline int piece_type_is_slider(PieceType pt) {
+inline int piece_is_slider(PieceType pt) {
   return SlidingArray[int(pt)];
 }
 
 inline SquareDelta pawn_push(Color c) {
   return SlidingArray[int(pt)];
 }
 
 inline SquareDelta pawn_push(Color c) {
-  return PawnPush[c];
+    return (c == WHITE ? DELTA_N : DELTA_S);
 }
 
 inline bool piece_type_is_ok(PieceType pc) {
 }
 
 inline bool piece_type_is_ok(PieceType pc) {
index 510784e593e8e1d5ab811d98177f295c6ada56e5..e5b5f5aa4a85dd7a2aa2c26222d8c6f2822b477b 100644 (file)
@@ -38,7 +38,6 @@
 #include "direction.h"
 #include "move.h"
 #include "piece.h"
 #include "direction.h"
 #include "move.h"
 #include "piece.h"
-#include "phase.h"
 #include "square.h"
 #include "value.h"
 
 #include "square.h"
 #include "value.h"
 
@@ -61,7 +60,7 @@ const int MaxGameLength = 220;
 //// Types
 ////
 
 //// Types
 ////
 
-/// Castle rights, encoded as bit fields:
+/// Castle rights, encoded as bit fields
 
 enum CastleRights {
   NO_CASTLES = 0,
 
 enum CastleRights {
   NO_CASTLES = 0,
@@ -72,6 +71,12 @@ enum CastleRights {
   ALL_CASTLES = 15
 };
 
   ALL_CASTLES = 15
 };
 
+/// Game phase
+enum Phase {
+  PHASE_ENDGAME = 0,
+  PHASE_MIDGAME = 128
+};
+
 
 /// The StateInfo struct stores information we need to restore a Position
 /// object to its previous state when we retract a move. Whenever a move
 
 /// The StateInfo struct stores information we need to restore a Position
 /// object to its previous state when we retract a move. Whenever a move
index 677761946df11436946474d30949c712375b2b3b..15146357b33107fe168a13a3b137856a043f34e8 100644 (file)
@@ -25,7 +25,6 @@
 //// Includes
 ////
 
 //// Includes
 ////
 
-#include "position.h"
 #include "value.h"
 
 
 #include "value.h"
 
 
index 1078af305178a4bb6cf4932ed19c349e3e5c49ca..ed1a2a907bc2bbf26f247f1d65776b892d1af7d0 100644 (file)
@@ -2,21 +2,21 @@
    (c) Copyright 1992 Eric Backus
 
    This software may be used freely so long as this copyright notice is
    (c) Copyright 1992 Eric Backus
 
    This software may be used freely so long as this copyright notice is
-   left intact.  There is no warrantee on this software.
- */
+   left intact. There is no warrantee on this software.
+*/
+
 #include <windows.h>
 #include <time.h>
 #include "dos.h"
 
 #include <windows.h>
 #include <time.h>
 #include "dos.h"
 
-
-int             gettimeofday(struct timeval * tp, struct timezone * tzp)
+int gettimeofday(struct timeval* tp, struct timezone* tzp)
 {
 {
-    SYSTEMTIME      systime;
-
-    if (tp) {
-        struct tm       tmrec;
-        time_t          theTime = time(NULL);
+    SYSTEMTIME systime;
 
 
+    if (tp)
+    {
+        struct tm tmrec;
+        time_t theTime = time(NULL);
 
         tmrec = *localtime(&theTime);
         tp->tv_sec = mktime(&tmrec);
 
         tmrec = *localtime(&theTime);
         tp->tv_sec = mktime(&tmrec);