00001
00002
00003 #ifndef _PAWNCHECKMATEMOVES_H
00004 #define _PAWNCHECKMATEMOVES_H
00005
00006 #include "osl/move.h"
00007 namespace osl
00008 {
00009 namespace checkmate
00010 {
00011 struct PawnCheckmateMoves
00012 {
00017 template <Player P>
00018 static bool effectiveOnlyIfPawnCheckmate(Ptype ptype,
00019 Position from, Position to)
00020 {
00021 return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
00022 && (from.canPromote<P>() || to.canPromote<P>());
00023 }
00024 static bool effectiveOnlyIfPawnCheckmate(Player a, Ptype ptype,
00025 Position from, Position to)
00026 {
00027 return ((ptype == PAWN) || (ptype == ROOK) || (ptype == BISHOP))
00028 && (from.canPromote(a) || to.canPromote(a));
00029 }
00030 static bool effectiveOnlyIfPawnCheckmate(Move m)
00031 {
00032 return effectiveOnlyIfPawnCheckmate(m.player(), m.ptype(),
00033 m.from(), m.to());
00034 }
00035
00036 static bool hasParingNoPromote(bool isPromote, Ptype ptype)
00037 {
00038 return isPromote
00039 && ((ptype == PPAWN) || (ptype == PROOK) || (ptype == PBISHOP));
00040 }
00045 static bool hasParingNoPromote(Move m)
00046 {
00047 return hasParingNoPromote(m.isPromote(), m.ptype());
00048 }
00049 };
00050 }
00051 }
00052
00053 #endif
00054
00055
00056
00057