Belofte version 2.1.8
A promising chess program using the UCI or Winboard interface
coordmove.cpp
Go to the documentation of this file.
1/*---------------------------------------------------------------------+
2 * File: coordmove.cpp
3 * Project: part of belofte - A Promising Chess Program
4 * Author: yves
5 * SPDX-License-Identifier: GPL-2.0-only
6+----------------------------------------------------------------------*/
7
8#include "belofte.h"
9
10bCoordMove::bCoordMove(std::string const& coordmove)
11 : bBasicMove{bCase(coordmove.substr(0, 2)).getCaseT(),
12 bCase(coordmove.substr(2, 2)).getCaseT()}
13{
14 if (coordmove.size() > 4)
15 setPromotion(static_cast<cpiece_t>(coordmove[4]));
16}
17
22
23void bCoordMove::setPromotion(const cpiece_t p)
24{
25 if ((p == tCPiece::C_W_QUEEN) || (p == tCPiece::C_B_QUEEN)) {
27 } else if ((p == tCPiece::C_W_KNIGHT) || (p == tCPiece::C_B_KNIGHT)) {
29 } else if ((p == tCPiece::C_W_ROOK) || (p == tCPiece::C_B_ROOK)) {
31 } else if ((p == tCPiece::C_W_BISHOP) || (p == tCPiece::C_B_BISHOP)) {
33 }
34}
35
36// eof
This is the main include file, needs to be included before any other include.
move
Definition move.h:12
ppiece_t m_promotion
Definition move.h:56
position on board, defined as 255 if invalid used primarily to compose a move or a source or destinat...
Definition case.h:17
bCoordMove(std::string const &coordmove)
Definition coordmove.cpp:10
@ C_W_KNIGHT
Definition piece.h:23
@ C_B_QUEEN
Definition piece.h:31
@ C_W_ROOK
Definition piece.h:26
@ C_B_BISHOP
Definition piece.h:27
@ C_W_QUEEN
Definition piece.h:25
@ C_B_KNIGHT
Definition piece.h:29
@ C_W_BISHOP
Definition piece.h:21
@ C_B_ROOK
Definition piece.h:32
enum tCPiece cpiece_t
Definition piece.h:35
@ N_P_KNIGHT
Definition piece.h:48
@ N_P_QUEEN
Definition piece.h:48
@ N_P_ROOK
Definition piece.h:48
@ N_P_BISHOP
Definition piece.h:48