Debug MainWindow and add comments

This commit is contained in:
Loic Guegan 2023-01-13 10:42:57 +01:00
parent 7009469e96
commit f754a93f9f
7 changed files with 29 additions and 12 deletions

View file

@ -5,13 +5,19 @@
#include "ochess.hpp"
#include <unordered_map>
/**
* @brief Hold an entire chess game
* Used in many places in the projects.
*/
class Game {
/// @brief 64 char string that contains all the pieces on the board (used in BoardCanvas)
std::string board;
std::string initial_fen;
std::string result;
std::unordered_map<std::string, std::string> tags;
HalfMove *moves;
HalfMove *current;
/// @brief Used by various methods of the class
chessarbiter::ChessArbiter arbiter;
public:
@ -29,12 +35,15 @@ public:
HalfMove *GetMoves();
std::string GetFen();
std::string GetResult();
/// @brief Play the given absolute move
bool Play(std::string move,char promotion='q');
bool IsBlackToPlay();
bool IsCheckmate(bool forBlack);
/// @brief Check if a given absolute move consists in a pawn promotion
bool IsPromotionMove(std::string absolute_move);
void Previous();
void Next();
/// @brief Delete a move (its mainline and variations recursively)
void DeleteMove(HalfMove *m);
void PromoteMove(HalfMove *m);
void SetMoveAsMainline(HalfMove *m);

View file

@ -7,11 +7,7 @@
#include <vector>
/**
* @brief Create your custom half move class
*
* The implementation of the class should give you
* an overview of how to keep your move sync with the one of CGEditor
*
* @brief This class extends CGEHalfMove (to be displayed in the game editor)
*/
class HalfMove : public cgeditor::CGEHalfMove {
HalfMove *parent = nullptr;
@ -19,8 +15,10 @@ class HalfMove : public cgeditor::CGEHalfMove {
chessarbiter::ChessArbiter arbiter;
std::vector<HalfMove *> variations;
std::string fen;
/// @brief Used in to retrieve captured pieces (see GetLineCaptures())
char capture;
void BuildAndVerify(HalfMove *m, std::string fen);
/// @brief Store the source and destination square of the current move (mainly used for pieces animation)
std::string src,dst;
public:

View file

@ -16,6 +16,7 @@ class LiveEngineDialog : public DialogLiveEngine {
uciadapter::UCI *engine;
std::string engine_name;
wxTimer timer;
/// @brief The following time interval definitely need to be configure in the user settings (set to 1s for now)
std::uint32_t interval;
public: