Removed killer, just use history. small cleanup.
[rattatechess.git] / move.h
blob3344bb1a422c15eff55d4703c4bb4d4568670288
1 /***************************************************************************
2 move.h - Move related definitions
3 -------------------
4 begin : Sun Nov 28 2007
5 copyright : (C) 2007 by Maurizio Monge
6 email : monge@linuz.sns.it
7 ***************************************************************************/
9 /***************************************************************************
10 * *
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. *
15 * *
16 ***************************************************************************/
18 #ifndef __MOVE_H__
19 #define __MOVE_H__
21 #include "utils.h"
23 // store all the possible moves of a knight.
24 class PACKED KnightMove
26 public:
27 uint8_t jump[8];
28 uint8_t numm;
32 /* PACKED, use a small structure even if unaligned.
33 if i can quote Alan Cox, "Cache is king" :) */
34 class PACKED Move
36 public:
37 union
39 struct
41 uint8_t from; /* square we are moving from */
42 uint8_t to; /* square we are moving to */
43 uint8_t capture;
44 uint8_t flags;
46 uint32_t as_int;
48 int16_t val;
49 uint8_t cost;
50 uint8_t extend;
52 int operator==(const Move& m){
53 return (as_int == m.as_int); }
54 int operator!=(const Move& m) {
55 return (as_int != m.as_int); }
57 static Move FromInt(int i)
59 Move m;
60 m.as_int = i;
61 return m;
63 static Move HT()
65 Move m;
66 m.as_int = 0xfffffffe;
67 return m;
69 static Move None()
71 Move m;
72 m.as_int = 0xffffffff;
73 return m;
77 #endif //__MOVE_H__