Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
lib
move_generator
additionalLance.cc
Go to the documentation of this file.
1
/* additionalLance.cc
2
*/
3
#include "
osl/move_generator/additionalLance.h
"
4
#include "
osl/container/moveVector.h
"
5
6
7
template
<osl::Player P>
8
void
osl::move_generator::AdditionalLance<P>::
9
generate
(
const
NumEffectState& state,
Square
pawn, MoveVector&
out
)
10
{
11
assert((state.hasPieceOnStand<
LANCE
>(P)));
12
assert(state.pieceOnBoard(pawn).ptype() ==
PAWN
);
13
Square
back_position = pawn +
DirectionPlayerTraits<D,P>::offset
();
14
Piece
target
= state.pieceAt(back_position);
15
while
(target.
isEmpty
())
16
{
17
if
(state.hasEffectAt<
PlayerTraits<P>::opponent
>(back_position))
18
break
;
19
out.push_back(
Move
(back_position,
LANCE
, P));
20
21
back_position = back_position + DirectionPlayerTraits<D,P>::offset();
22
target = state.pieceAt(back_position);
23
}
24
}
25
26
template
<osl::Player P>
27
void
osl::move_generator::AdditionalLance<P>::
28
generateIfHasLance
(
const
NumEffectState& state,
Square
pawn,
29
MoveVector&
out
)
30
{
31
if
(state.hasPieceOnStand<
LANCE
>(P))
32
generate
(state, pawn, out);
33
}
34
namespace
osl
35
{
36
namespace
move_generator
37
{
38
template
struct
AdditionalLance<BLACK>
;
39
template
struct
AdditionalLance<WHITE>
;
40
}
41
}
42
43
/* ------------------------------------------------------------------------- */
44
// ;;; Local Variables:
45
// ;;; mode:c++
46
// ;;; c-basic-offset:2
47
// ;;; End:
Generated on Sun Jul 21 2013 13:37:23 by
1.8.4