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
10
bCoordMove::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
18
bCoordMove::bCoordMove
(
bBasicMove
const
& m)
19
:
bBasicMove
{m}
20
{
21
}
22
23
void
bCoordMove::setPromotion(
const
cpiece_t
p)
24
{
25
if
((p ==
tCPiece::C_W_QUEEN
) || (p ==
tCPiece::C_B_QUEEN
)) {
26
m_promotion
=
tPPiece::N_P_QUEEN
;
27
}
else
if
((p ==
tCPiece::C_W_KNIGHT
) || (p ==
tCPiece::C_B_KNIGHT
)) {
28
m_promotion
=
tPPiece::N_P_KNIGHT
;
29
}
else
if
((p ==
tCPiece::C_W_ROOK
) || (p ==
tCPiece::C_B_ROOK
)) {
30
m_promotion
=
tPPiece::N_P_ROOK
;
31
}
else
if
((p ==
tCPiece::C_W_BISHOP
) || (p ==
tCPiece::C_B_BISHOP
)) {
32
m_promotion
=
tPPiece::N_P_BISHOP
;
33
}
34
}
35
36
// eof
belofte.h
This is the main include file, needs to be included before any other include.
bBasicMove
move
Definition
move.h:12
bBasicMove::m_promotion
ppiece_t m_promotion
Definition
move.h:56
bCase
position on board, defined as 255 if invalid used primarily to compose a move or a source or destinat...
Definition
case.h:17
bCoordMove::bCoordMove
bCoordMove(std::string const &coordmove)
Definition
coordmove.cpp:10
C_W_KNIGHT
@ C_W_KNIGHT
Definition
piece.h:23
C_B_QUEEN
@ C_B_QUEEN
Definition
piece.h:31
C_W_ROOK
@ C_W_ROOK
Definition
piece.h:26
C_B_BISHOP
@ C_B_BISHOP
Definition
piece.h:27
C_W_QUEEN
@ C_W_QUEEN
Definition
piece.h:25
C_B_KNIGHT
@ C_B_KNIGHT
Definition
piece.h:29
C_W_BISHOP
@ C_W_BISHOP
Definition
piece.h:21
C_B_ROOK
@ C_B_ROOK
Definition
piece.h:32
cpiece_t
enum tCPiece cpiece_t
Definition
piece.h:35
N_P_KNIGHT
@ N_P_KNIGHT
Definition
piece.h:48
N_P_QUEEN
@ N_P_QUEEN
Definition
piece.h:48
N_P_ROOK
@ N_P_ROOK
Definition
piece.h:48
N_P_BISHOP
@ N_P_BISHOP
Definition
piece.h:48
src
coordmove.cpp
Generated on 10/10/2024 by
1.9.8