| stellarUCI Chess engine written in C++20 | 
| git clone git://git.dimitrijedobrota.com/stellar.git | 
| Log | Files | Refs | README | LICENSE | 
game.hpp (1603B)
    0 #ifndef STELLAR_ARENA_GAME_H
              1 #define STELLAR_ARENA_GAME_H
          
              3 #include "movelist.hpp"
          
              5 class Game {
              6   public:
              7     static const std::string startPosition;
              8     enum Terminate {
              9         Deatch,
             10         Timeout,
             11         Illegal,
             12         Repetition,
             13     };
          
             15     Game(const uint16_t match_id, const std::string white, const std::string black, const std::string fen);
             16     ~Game();
          
             18     void play(const Move move) { list.push(move); }
          
             20     const std::string get_moves(void) const;
             21     const std::string &get_white(void) const { return white; }
             22     const std::string &get_black(void) const { return black; }
             23     const Terminate get_terminate(void) const { return terminate; }
          
             25     const bool is_win_white(void) const { return !draw && winner == color::WHITE; }
             26     const bool is_win_black(void) const { return !draw && winner == color::BLACK; }
             27     const bool is_draw(void) const { return draw; }
          
             29     void set_terminate(const Terminate terminate) { this->terminate = terminate; }
             30     void set_winner(const color::Color winner) { this->winner = winner; }
             31     void set_draw(const bool draw) { this->draw = draw; }
          
             33     static void set_san(bool san) { Game::san = san; }
          
             35     friend std::ostream &operator<<(std::ostream &os, const Game &game);
          
             37   private:
             38     static const std::string to_san(const Board &board, const Move move);
          
             40     static uint16_t id_t;
             41     uint16_t id = id_t++;
             42     uint16_t match_id;
          
             44     const std::string white, black;
             45     const std::string fen;
             46     MoveList list;
          
             48     bool draw = false;
             49     color::Color winner;
             50     Terminate terminate = Terminate::Deatch;
          
             52     static bool san;
             53 };
          
             55 #endif