3#ifndef OSL_SIMPLE_STATE_TCC
4#define OSL_SIMPLE_STATE_TCC
6#include "osl/simpleState.h"
9template <bool show_error>
10bool osl::SimpleState::isAlmostValidDrop(Move move) const
12 assert(move.from().isPieceStand());
13 const Square to=move.to();
14 const Piece to_piece=pieceAt(to);
15 const Ptype ptype=move.ptype();
16 const Player turn = move.player();
18 if (! to_piece.isEmpty()) {
19 if (show_error) std::cerr << "drop on to piece : " << move << std::endl;
23 if (! hasPieceOnStand(turn,ptype)) {
24 if (show_error) std::cerr << turn << " don't have : " << ptype << std::endl;
28 if (ptype==PAWN && isPawnMaskSet(turn, to.x())) {
29 if (show_error) std::cerr << " Double Pawn : " << move << std::endl;
35template <bool show_error>
37osl::SimpleState::testValidityOtherThanEffect(Move move) const
39 const Square from=move.from();
40 const Piece from_piece = pieceAt(from);
41 const Square to=move.to();
42 const Piece to_piece=pieceAt(to);
44 if (from_piece.isEmpty()
45 || (from_piece.owner() != turn()))
48 std::cerr << " No such piece0 : " << move << std::endl;
51 // promoteしている時にpromote可能か
52 if (move.isPromotion())
55 if (from_piece.ptype() != unpromote(move.ptype()))
58 std::cerr << " No such piece1 : " << move << std::endl;
61 if (from_piece.isPromotedNotKingGold())
64 std::cerr << " can't promote promoted piece : " << move << std::endl;
71 if (from_piece.ptype() != move.ptype())
74 std::cerr << " No such piece2 : " << move << std::endl;
79 if (!to_piece.isEmpty() && to_piece.owner()==turn()) {
80 if (show_error) std::cerr << " No move on : " << move << std::endl;
83 // capturePtypeが一致しているか?
84 if (to_piece.ptype()!=move.capturePtype()) {
85 if (show_error) std::cerr << " Not such capture : " << move
86 << std::endl << *this;
93#endif /* _SIMPLE_STATE_TCC */
94// ;;; Local Variables:
96// ;;; c-basic-offset:2