ochess/src/game_tab/Game.hpp

46 lines
1.1 KiB
C++
Raw Normal View History

2022-02-23 18:11:55 +01:00
#pragma once
#include "ChessArbiter.hpp"
#include "HalfMove.hpp"
#include "ochess.hpp"
#include <unordered_map>
class Game {
std::string board;
std::string initial_fen;
std::string result;
2022-02-23 18:11:55 +01:00
std::unordered_map<std::string, std::string> tags;
HalfMove *moves;
HalfMove *current;
chessarbiter::ChessArbiter arbiter;
public:
Game();
Game(std::string fen);
2022-02-23 18:47:18 +01:00
Game(HalfMove *m, std::string initial_fen);
2022-02-23 18:11:55 +01:00
std::string GetBoard();
std::string GetTag(std::string tagname);
void SetTag(std::string tagname, std::string value);
void DeleteTag(std::string tagname);
HalfMove *GetCurrentMove();
HalfMove *GetMoves();
std::string GetFen();
bool Play(std::string move);
bool IsBlackToPlay();
void Previous();
void Next();
void DeleteMove(HalfMove *m);
void PromoteMove(HalfMove *m);
void SetMoveAsMainline(HalfMove *m);
void SetCurrent(HalfMove *m);
std::vector<std::string> ListTags();
std::string GetPGN();
void SetResult(std::string result);
2022-02-25 13:38:49 +01:00
/**
* @brief Build current game
* Verify and play all the moves in the game
* while building the fen for each move
*/
2022-02-25 11:42:46 +01:00
void BuildAndVerify();
2022-02-23 18:11:55 +01:00
};