1 /***************************************************************************
2 move.h - Move related definitions
4 begin : Sun Sep 28 2007
5 copyright : (C) 2007 by Maurizio Monge
6 email : monge@linuz.sns.it
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
24 // store all the possible moves of a knight.
25 class PACKED KnightMove
33 /* PACKED, use a small structure even if unaligned.
34 if i can quote Alan Cox, "Cache is king" :) */
42 uint8_t from
; /* square we are moving from */
43 uint8_t to
; /* square we are moving to */
53 bool operator==(const Move
& m
) const { return (as_int
== m
.as_int
); }
54 bool operator!=(const Move
& m
) const { return (as_int
!= m
.as_int
); }
55 bool operator<(const Move
& m
) const { return (as_int
< m
.as_int
); }
57 bool valid() const { return as_int
<0xff000000; }
59 static Move
FromInt(int i
)
65 static Move
None() { return FromInt(0xffffffff); }
66 static Move
Illegal() { return FromInt(0xfffffffe); }
67 static Move
Ambiguous() { return FromInt(0xfffffffd); }
75 uint8_t castle_passing_mask
;
80 typedef Buf
<char, 64> MoveStr
;