Subversion Repositories Games.Chess Giants

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.     Protector -- a UCI chess engine
  3.  
  4.     Copyright (C) 2009-2010 Raimund Heid (Raimund_Heid@yahoo.com)
  5.  
  6.     This program is free software: you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation, either version 3 of the License, or
  9.     (at your option) any later version.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  
  19. */
  20.  
  21. #ifndef _io_h_
  22. #define _io_h_
  23.  
  24. #include "protector.h"
  25. #include "bitboard.h"
  26. #include "position.h"
  27. #include "movegeneration.h"
  28.  
  29. extern char pieceSymbol[16];
  30.  
  31. /**
  32.  * Initialize this module.
  33.  *
  34.  * @return 0 if no errors occurred.
  35.  */
  36. int initializeModuleIo(void);
  37.  
  38. /**
  39.  * Test this module.
  40.  *
  41.  * @return 0 if all tests succeed.
  42.  */
  43. int testModuleIo(void);
  44.  
  45. /**
  46.  * Stop program execution until the user strikes a key.
  47.  */
  48. int getKeyStroke(void);
  49.  
  50. /**
  51.  * Send a string representation of the specified bitboard to stdout.
  52.  */
  53. void dumpBitboard(Bitboard bitboard, char *title);
  54.  
  55. /**
  56.  * Send a string representation of the specified balance value to stdout.
  57.  */
  58. void dumpBalance(const INT32 balance);
  59.  
  60. /**
  61.  * Send a string representation of the specified value array to stdout.
  62.  */
  63. void dumpBoardValues(const int value[64]);
  64.  
  65. /**
  66.  * Send a string representation of the specified square to stdout.
  67.  */
  68. void dumpSquare(const Square square);
  69.  
  70. /**
  71.  * Send a string representation of the specified move to stdout.
  72.  */
  73. void dumpMove(const Move move);
  74. void logMove(const Move move);
  75.  
  76. /**
  77.  * Send a string representation of the specified movelist to stdout.
  78.  */
  79. void dumpMovelist(const Movelist * movelist);
  80.  
  81. /**
  82.  * Send a string representation of the specified pv to stdout.
  83.  */
  84. void dumpPv(int depth, long timestamp,
  85.             const char *moves, int value, UINT64 nodes,
  86.             const Color activeColor);
  87.  
  88. /**
  89.  * Send a string representation of the specified position to stdout.
  90.  */
  91. void logPosition(const Position * position);
  92.  
  93. /**
  94.  * Send a string representation of the specified position to stdout
  95.  * and wait for a keystroke.
  96.  */
  97. void dumpPosition(const Position * position);
  98.  
  99. /**
  100.  * Send a string representation of the specified variation to stdout
  101.  * and wait for a keystroke.
  102.  */
  103. void dumpVariation(const Variation * variation);
  104.  
  105. /**
  106.  * Send a string representation of the specified variation to stdout.
  107.  */
  108. void reportVariation(const Variation * variation);
  109.  
  110. /**
  111.  * Get the name of the specified square.
  112.  */
  113. void getSquareName(Square square, char name[3]);
  114.  
  115. /**
  116.  * Get a dump of the specified move.
  117.  */
  118. void getMoveDump(const Move move, char *buffer);
  119.  
  120. /**
  121.  * Close the logfile.
  122.  */
  123. void closeLogfile(void);
  124.  
  125. /**
  126.  * Write the specified message to the logfile.
  127.  */
  128. void logDebug(const char *fmt, ...);
  129.  
  130. /**
  131.  * Write the specified message to the logfile.
  132.  */
  133. void logReport(const char *fmt, ...);
  134.  
  135. /**
  136.  * Format the given integer value by adding thousands separators.
  137.  */
  138. void formatLongInteger(UINT64 n, char *buffer);
  139.  
  140. /**
  141.  * Format the given centipawn value according to the uci protocol.
  142.  */
  143. void formatUciValue(const int centipawnValue, char *buffer);
  144.  
  145. /**
  146.  * Write the specified table to a source code file.
  147.  */
  148. void writeTableToFile(UINT64 * table, const int tablesize,
  149.                       const char *fileName, const char *tableName);
  150.  
  151. #endif
  152.