///////////////////////////////////////////////////////////////////////////// // // EpdProcessor.h : interface for EPD Processing classes // // Written by Thomas F. Mooney, III (tfm3@teleproc.com) // Copyright © 1999. // // This code may be used in compiled form in any way you desire. This // file may be redistributed unmodified by any means PROVIDING it is // not sold for profit without the authors written consent, and // providing that this notice and the authors name is included. If // the source code in this file is used in any commercial application // then acknowledgement must be made to the author of this file // (in whatever form you wish). // // This file is provided "as is" with no expressed or implied warranty. // The author accepts no liability if it causes any damage to your // computer, data, etc. // // Please report any bugs/anomalies/suggestions to the author via the // e-mail address listed above. // ///////////////////////////////////////////////////////////////////////////// #if !defined(EpdProcessor_h_) #define EpdProcessor_h_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000> ///////////////////////////////////////////////////////////////////////////// // This file contains the definition of the EpdProcessor class. ///////////////////////////////////////////////////////////////////////////// #pragma warning (disable:4786) // Turn off innocuous warning message #include #include #include #include "TpmChess.h" // include support classes #include "EpdBinary.h" class EpdProcessor { public: EpdProcessor(); ~EpdProcessor(); bool SetEpd(EPD EpdPosition); bool SetEpdBinary(EpdBinary EpdPosition); std::string GetEpdError(); int SetPv(PV SanMoves); std::string GetPvError(); PV GetPv(); EPD GetEpd(int HalfMoveCount); EpdBinary GetEpdBinary(int HalfMoveCount); EPD_VECTOR GetEpdVector(); EPD_BINARY_VECTOR GetEpdBinaryVector(); EPD_LIST GetLegalEpdList(); EPD_BINARY_LIST GetLegalEpdBinaryList(); SAN_LIST GetLegalSanList(); bool IsCheckmate(); bool IsStalemate(); int IsMoveLegal(SAN& San); std::string GetSanError(); bool IsEnPassantCapturePossible(); void GenerateOutputOpcodes(bool Generate = false); void SetOutputOpcodeTypes(bool hm = true, bool hmvc = true, bool fmvn = true); protected: private: void ValidatePiecePlacement(); void ValidateActiveColor(char* pActiveColor); void ValidateCastleAvailability(); void ValidateEnPassantTarget(); void GenerateEpdVector(); void GenerateLegalEpds(); public: protected: ChessBoard m_Board; // simulates chess game bool m_bGenerateOpcodes; // generate EPD opcodes bool m_bOpcode_hm; bool m_bOpcode_hmvc; bool m_bOpcode_fmvn; bool m_bEpdValid; // indicates supplied data valid int m_nPvValid; int m_nSanValid; std::string m_EpdErrorMsg; // details error with supplied data std::string m_PvErrorMsg; std::string m_SanErrorMsg; bool m_bEpCapturePossible; // indicates capturable en passant target std::string m_PiecePlacement; // breaks down EPD bool m_bWhiteToMove; std::string m_CastleAvailability; std::string m_EnPassantTarget; int m_nHalfMoveClock; int m_nFullMoveNumber; std::string m_PV; // stores processed PV EPD_VECTOR m_EpdVector; // output EPDs and moves EPD_BINARY_VECTOR m_EpdBinaryVector; EPD_LIST m_EpdList; EPD_BINARY_LIST m_EpdBinaryList; SAN_LIST m_SanList; bool m_bCheckmate; // indicates reason no valid moves/EPDs bool m_bStalemate; // from the supplied EPD private: }; #endif // !defined(EpdProcessor_h_)