engine.h 1.4 KB
#ifndef ENGINE_H
#define ENGINE_H



#include "utility.h"

#include <basic_types.h>
#include <engine_interface.h>


namespace othello
{
/*
    class OpeningBook {
      // ...
    };

    class GreenBookWormAI : public AIInterface {
    public:
      GreenBookWormAI( const OpeningBook& openingbook )
        : m_openingbook{openingbook} {}
      // ...
    private:
      const OpeningBook m_openingbook;
    };
*/

  class OthelloGameEngine : public othello::GameEngineInterface {
    // GameEngineInterface interface



  public:
    bool initNewGame() override;
    void clearGame() override;
    bool performMoveForCurrentHuman(const othello::BitPos&) override;
    bool noLegalMoves(const othello::PlayerId& playerid);
    void switchCurrentPlayerId();
    void think(const std::chrono::seconds&) override;

    void forfeitTurn(bool flag);
    bool ifGameStarted();
    bool forfeitedLastTurn();


    othello::PlayerId   currentPlayerId() const override;
    othello::PlayerType currentPlayerType() const override;
    othello::BitPieces  pieces(const othello::PlayerId&) const override;

    const othello::BitBoard& board() const override;

//    const OpeningBook m_openingbook;

  private:
    void aiThinkAndMove(detail::PlayerStruct& player, const std::chrono::seconds& time_limit);

    bool forfeited;
    bool game_started;
    PlayerId current_playerid = PlayerId::One;
  };

} // namespace othello
#endif   // ENGINE_H