Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Napoleon - uci.h

uci.h

Caricato da: Crybot
Scarica il programma completo

  1. #ifndef UCI_H
  2. #define UCI_H
  3. #include <sstream>
  4. #include <iostream>
  5. #include <thread>
  6.  
  7. namespace Napoleon
  8. {
  9.     namespace Command
  10.     {
  11.         typedef int Type;
  12.         const Type Generic = 0;
  13.         const Type Move = 1;
  14.         const Type Info = 2;
  15.     }
  16.  
  17.     class Board;
  18.     namespace Uci
  19.     {
  20.         void Start();
  21.         template<Command::Type>
  22.         void SendCommand(std::string);  
  23.         void go(std::istringstream&);
  24.  
  25.         extern Board board;
  26.         extern std::thread search;
  27.     }
  28.  
  29.     template<Command::Type cmdType>
  30.     void Uci::SendCommand(std::string command)
  31.     {
  32.         switch(cmdType)
  33.         {
  34.         case Command::Generic:
  35.             std::cout << command << std::endl;
  36.             break;
  37.         case Command::Move:
  38.             std::cout << "bestmove " << command << std::endl;
  39.             break;
  40.         case Command::Info:
  41.             std::cout << "info " << command << std::endl;
  42.             break;
  43.         default:
  44.             std::cout << std::endl;
  45.             break;
  46.         }
  47.     }
  48. }
  49.  
  50. #endif // UCI_H