1 /* Copyright (C) 2007-2012 Vincent Ollivier
3 * Purple Haze is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * Purple Haze is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 PieceType
Move::promotion_type() const
26 case KNIGHT_PROMOTION
:
27 case KNIGHT_PROMOTION_CAPTURE
:
29 case BISHOP_PROMOTION
:
30 case BISHOP_PROMOTION_CAPTURE
:
33 case ROOK_PROMOTION_CAPTURE
:
36 case QUEEN_PROMOTION_CAPTURE
:
43 PieceType
Move::castle_side() const
55 std::ostream
& operator<<(std::ostream
& out
, const Move move
)
57 return (out
<< move
.to_string());
60 std::string
Move::to_string() const
66 res
+= static_cast<char>('a' + orig_file());
67 res
+= static_cast<char>('1' + orig_rank());
68 res
+= static_cast<char>('a' + dest_file());
69 res
+= static_cast<char>('1' + dest_rank());
71 res
+= Piece(BLACK
, promotion_type()).to_string(); // Lower case