Classes | Typedefs | Enumerations | Functions | Variables
cwchess Namespace Reference

A namespace for all chess related objects that are not related to the GUI. More...

Classes

struct  ArrayCode
 
struct  ArrayColor
 
struct  ArrayIndex
 
class  BitBoard
 A one-boolean-per-square chessboard. More...
 
struct  BitBoardData
 The POD base type of class BitBoard. More...
 
class  CastleFlags
 A class to keep track of castling rights. More...
 
class  ChessGame
 
class  ChessNotation
 A helper class to write other objects to an ostream. More...
 
class  ChessPosition
 A chess position. More...
 
class  Code
 A chess piece type including color. More...
 
struct  CodeData
 The POD base type of class Code. More...
 
class  Color
 A color (black or white). More...
 
struct  ColorData
 The POD base type of class Color. More...
 
class  CountBoard
 
struct  Direction
 
class  EnPassant
 An object representing en passant information. More...
 
class  Flags
 Flags representing the state of a piece on the chessboard. More...
 
struct  FlagsData
 The POD base type of class Flags. More...
 
class  GameNode
 
class  Index
 The index of a chess square. More...
 
struct  IndexData
 The POD base type of class Index. More...
 
class  MetaData
 
class  Move
 A chess move in a particular chess position. More...
 
class  MoveIterator
 Non-mutable iterator over all moves of a given chess piece. More...
 
class  Piece
 A particular piece on the board. More...
 
class  PieceIterator
 Non-mutable iterator over selective chess pieces in a chess position. More...
 
class  Promotion
 
class  Type
 A chess piece type. More...
 
struct  TypeData
 The POD base type of class Type. More...
 

Typedefs

typedef uint64_t mask_t
 The type of an internal BitBoard mask. More...
 
typedef uint16_t CwChessboardCode
 

Enumerations

enum  up_and_right { right = 1, up_left = 7, up = 8, up_right = 9 }
 
enum  down_and_left { left = 1, down_right = 7, down = 8, down_left = 9 }
 

Functions

mask_t index2mask (Index index)
 Convert Index to a mask_t.
 
mask_t colrow2mask (int col, int row)
 Convert a col, row pair to a mask_t.
 
Index mask2index (mask_t mask)
 Convert a single bit mask into it's Index. More...
 
bool operator== (BitBoardData b1, BitBoardData b2)
 
bool operator!= (BitBoardData b1, BitBoardData b2)
 
BitBoardData operator| (BitBoardData x, BitBoardData y)
 Calculate the union of two bit board constants.
 
BitBoardData operator& (BitBoardData x, BitBoardData y)
 Calculate the intersection of two bit board constants.
 
BitBoardData operator^ (BitBoardData x, BitBoardData y)
 Calculate the union minus the intersection of two bit board constants.
 
BitBoardData operator~ (BitBoardData x)
 Calculate the inverse of the bitboard constant.
 
std::ostream&  operator<< (std::ostream& os, ChessNotation const& chess_notation)
 
template<typename T >
void move (mask_t& m, T)
 
template<>
void move< up_and_right > (mask_t& m, up_and_right offset)
 
template<>
void move< down_and_left > (mask_t& m, down_and_left offset)
 
bool operator== (CodeData c1, CodeData c2)
 
bool operator!= (CodeData c1, CodeData c2)
 
bool operator== (ColorData c1, ColorData c2)
 
bool operator!= (ColorData c1, ColorData c2)
 
BitBoard squares_from_to (Index const& from, Index const& to)
 
Direction const&  direction_from_to (Index const& from, Index const& to)
 
bool operator== (FlagsData f1, FlagsData f2)
 
bool operator!= (FlagsData f1, FlagsData f2)
 
FlagsData operator| (FlagsData x, FlagsData y)
 Calculate the union of two Flags constants.
 
FlagsData operator& (FlagsData x, FlagsData y)
 Calculate the intersection of two Flags constants.
 
FlagsData operator^ (FlagsData x, FlagsData y)
 Calculate the union minus the intersection of two Flags constants.
 
bool operator== (IndexData i1, IndexData i2)
 
bool operator!= (IndexData i1, IndexData i2)
 
bool operator== (TypeData t1, TypeData t2)
 
bool operator!= (TypeData t1, TypeData t2)
 

Variables

BitBoardData const a1 = { CW_MASK_T_CONST(0x1) }
 The square a1.
 
BitBoardData const b1 = { CW_MASK_T_CONST(0x2) }
 The square b1.
 
BitBoardData const c1 = { CW_MASK_T_CONST(0x4) }
 The square c1.
 
BitBoardData const d1 = { CW_MASK_T_CONST(0x8) }
 The square d1.
 
BitBoardData const e1 = { CW_MASK_T_CONST(0x10) }
 The square e1.
 
BitBoardData const f1 = { CW_MASK_T_CONST(0x20) }
 The square f1.
 
BitBoardData const g1 = { CW_MASK_T_CONST(0x40) }
 The square g1.
 
BitBoardData const h1 = { CW_MASK_T_CONST(0x80) }
 The square h1.
 
BitBoardData const a2 = { CW_MASK_T_CONST(0x100) }
 The square a2.
 
BitBoardData const b2 = { CW_MASK_T_CONST(0x200) }
 The square b2.
 
BitBoardData const c2 = { CW_MASK_T_CONST(0x400) }
 The square c2.
 
BitBoardData const d2 = { CW_MASK_T_CONST(0x800) }
 The square d2.
 
BitBoardData const e2 = { CW_MASK_T_CONST(0x1000) }
 The square e2.
 
BitBoardData const f2 = { CW_MASK_T_CONST(0x2000) }
 The square f2.
 
BitBoardData const g2 = { CW_MASK_T_CONST(0x4000) }
 The square g2.
 
BitBoardData const h2 = { CW_MASK_T_CONST(0x8000) }
 The square h2.
 
BitBoardData const a3 = { CW_MASK_T_CONST(0x10000) }
 The square a3.
 
BitBoardData const b3 = { CW_MASK_T_CONST(0x20000) }
 The square b3.
 
BitBoardData const c3 = { CW_MASK_T_CONST(0x40000) }
 The square c3.
 
BitBoardData const d3 = { CW_MASK_T_CONST(0x80000) }
 The square d3.
 
BitBoardData const e3 = { CW_MASK_T_CONST(0x100000) }
 The square e3.
 
BitBoardData const f3 = { CW_MASK_T_CONST(0x200000) }
 The square f3.
 
BitBoardData const g3 = { CW_MASK_T_CONST(0x400000) }
 The square g3.
 
BitBoardData const h3 = { CW_MASK_T_CONST(0x800000) }
 The square h3.
 
BitBoardData const a4 = { CW_MASK_T_CONST(0x1000000) }
 The square a4.
 
BitBoardData const b4 = { CW_MASK_T_CONST(0x2000000) }
 The square b4.
 
BitBoardData const c4 = { CW_MASK_T_CONST(0x4000000) }
 The square c4.
 
BitBoardData const d4 = { CW_MASK_T_CONST(0x8000000) }
 The square d4.
 
BitBoardData const e4 = { CW_MASK_T_CONST(0x10000000) }
 The square e4.
 
BitBoardData const f4 = { CW_MASK_T_CONST(0x20000000) }
 The square f4.
 
BitBoardData const g4 = { CW_MASK_T_CONST(0x40000000) }
 The square g4.
 
BitBoardData const h4 = { CW_MASK_T_CONST(0x80000000) }
 The square h4.
 
BitBoardData const a5 = { CW_MASK_T_CONST(0x100000000) }
 The square a5.
 
BitBoardData const b5 = { CW_MASK_T_CONST(0x200000000) }
 The square b5.
 
BitBoardData const c5 = { CW_MASK_T_CONST(0x400000000) }
 The square c5.
 
BitBoardData const d5 = { CW_MASK_T_CONST(0x800000000) }
 The square d5.
 
BitBoardData const e5 = { CW_MASK_T_CONST(0x1000000000) }
 The square e5.
 
BitBoardData const f5 = { CW_MASK_T_CONST(0x2000000000) }
 The square f5.
 
BitBoardData const g5 = { CW_MASK_T_CONST(0x4000000000) }
 The square g5.
 
BitBoardData const h5 = { CW_MASK_T_CONST(0x8000000000) }
 The square h5.
 
BitBoardData const a6 = { CW_MASK_T_CONST(0x10000000000) }
 The square a6.
 
BitBoardData const b6 = { CW_MASK_T_CONST(0x20000000000) }
 The square b6.
 
BitBoardData const c6 = { CW_MASK_T_CONST(0x40000000000) }
 The square c6.
 
BitBoardData const d6 = { CW_MASK_T_CONST(0x80000000000) }
 The square d6.
 
BitBoardData const e6 = { CW_MASK_T_CONST(0x100000000000) }
 The square e6.
 
BitBoardData const f6 = { CW_MASK_T_CONST(0x200000000000) }
 The square f6.
 
BitBoardData const g6 = { CW_MASK_T_CONST(0x400000000000) }
 The square g6.
 
BitBoardData const h6 = { CW_MASK_T_CONST(0x800000000000) }
 The square h6.
 
BitBoardData const a7 = { CW_MASK_T_CONST(0x1000000000000) }
 The square a7.
 
BitBoardData const b7 = { CW_MASK_T_CONST(0x2000000000000) }
 The square b7.
 
BitBoardData const c7 = { CW_MASK_T_CONST(0x4000000000000) }
 The square c7.
 
BitBoardData const d7 = { CW_MASK_T_CONST(0x8000000000000) }
 The square d7.
 
BitBoardData const e7 = { CW_MASK_T_CONST(0x10000000000000) }
 The square e7.
 
BitBoardData const f7 = { CW_MASK_T_CONST(0x20000000000000) }
 The square f7.
 
BitBoardData const g7 = { CW_MASK_T_CONST(0x40000000000000) }
 The square g7.
 
BitBoardData const h7 = { CW_MASK_T_CONST(0x80000000000000) }
 The square h7.
 
BitBoardData const a8 = { CW_MASK_T_CONST(0x100000000000000) }
 The square a8.
 
BitBoardData const b8 = { CW_MASK_T_CONST(0x200000000000000) }
 The square b8.
 
BitBoardData const c8 = { CW_MASK_T_CONST(0x400000000000000) }
 The square c8.
 
BitBoardData const d8 = { CW_MASK_T_CONST(0x800000000000000) }
 The square d8.
 
BitBoardData const e8 = { CW_MASK_T_CONST(0x1000000000000000) }
 The square e8.
 
BitBoardData const f8 = { CW_MASK_T_CONST(0x2000000000000000) }
 The square f8.
 
BitBoardData const g8 = { CW_MASK_T_CONST(0x4000000000000000) }
 The square g8.
 
BitBoardData const h8 = { CW_MASK_T_CONST(0x8000000000000000) }
 The square h8.
 
BitBoardData const file_a = a1|a2|a3|a4|a5|a6|a7|a8
 The a-file.
 
BitBoardData const file_b = b1|b2|b3|b4|b5|b6|b7|b8
 The b-file.
 
BitBoardData const file_c = c1|c2|c3|c4|c5|c6|c7|c8
 The c-file.
 
BitBoardData const file_d = d1|d2|d3|d4|d5|d6|d7|d8
 The d-file.
 
BitBoardData const file_e = e1|e2|e3|e4|e5|e6|e7|e8
 The e-file.
 
BitBoardData const file_f = f1|f2|f3|f4|f5|f6|f7|f8
 The f-file.
 
BitBoardData const file_g = g1|g2|g3|g4|g5|g6|g7|g8
 The g-file.
 
BitBoardData const file_h = h1|h2|h3|h4|h5|h6|h7|h8
 The h-file.
 
BitBoardData const rank_1 = a1|b1|c1|d1|e1|f1|g1|h1
 The first rank.
 
BitBoardData const rank_2 = a2|b2|c2|d2|e2|f2|g2|h2
 The second rank.
 
BitBoardData const rank_3 = a3|b3|c3|d3|e3|f3|g3|h3
 The third rank.
 
BitBoardData const rank_4 = a4|b4|c4|d4|e4|f4|g4|h4
 The fourth rank.
 
BitBoardData const rank_5 = a5|b5|c5|d5|e5|f5|g5|h5
 The fifth rank.
 
BitBoardData const rank_6 = a6|b6|c6|d6|e6|f6|g6|h6
 The sixth rank.
 
BitBoardData const rank_7 = a7|b7|c7|d7|e7|f7|g7|h7
 The seventh rank.
 
BitBoardData const rank_8 = a8|b8|c8|d8|e8|f8|g8|h8
 The eighth rank.
 
BitBoardData const bdl_1 = h8
 The black diagonal from h8 to h8.
 
BitBoardData const bdl_2 = f8|g7|h6
 The black diagonal from f8 to h6.
 
BitBoardData const bdl_3 = d8|e7|f6|g5|h4
 The black diagonal from d8 to h4.
 
BitBoardData const bdl_4 = b8|c7|d6|e5|f4|g3|h2
 The black diagonal from b8 to h2.
 
BitBoardData const bdl_5 = a7|b6|c5|d4|e3|f2|g1
 The black diagonal from a7 to g1.
 
BitBoardData const bdl_6 = a5|b4|c3|d2|e1
 The black diagonal from a5 to e1.
 
BitBoardData const bdl_7 = a3|b2|c1
 The black diagonal from a3 to c1.
 
BitBoardData const bdl_8 = a1
 The black diagonal from a1 to a1.
 
BitBoardData const bdr_1 = a7|b8
 The black diagonal from a7 to b8.
 
BitBoardData const bdr_2 = a5|b6|c7|d8
 The black diagonal from a5 to d8.
 
BitBoardData const bdr_3 = a3|b4|c5|d6|e7|f8
 The black diagonal from a3 to f8.
 
BitBoardData const bdr_4 = a1|b2|c3|d4|e5|f6|g7|h8
 The black diagonal from a1 to h8.
 
BitBoardData const bdr_5 = c1|d2|e3|f4|g5|h6
 The black diagonal from c1 to h6.
 
BitBoardData const bdr_6 = e1|f2|g3|h4
 The black diagonal from e1 to h4.
 
BitBoardData const bdr_7 = g1|h2
 The black diagonal from g1 ti h2.
 
BitBoardData const wdr_1 = a8
 The white diagonal from a8 to a8.
 
BitBoardData const wdr_2 = a6|b7|c8
 The white diagonal from a6 to c8.
 
BitBoardData const wdr_3 = a4|b5|c6|d7|e8
 The white diagonal from a4 to e8.
 
BitBoardData const wdr_4 = a2|b3|c4|d5|e6|f7|g8
 The white diagonal from a2 to g8.
 
BitBoardData const wdr_5 = b1|c2|d3|e4|f5|g6|h7
 The white diagonal from b1 to h7.
 
BitBoardData const wdr_6 = d1|e2|f3|g4|h5
 The white diagonal from d1 to h5.
 
BitBoardData const wdr_7 = f1|g2|h3
 The white diagonal from f1 to h3.
 
BitBoardData const wdr_8 = h1
 The white diagonal from h1 to h1.
 
BitBoardData const wdl_1 = g8|h7
 The white diagonal from g8 to h7.
 
BitBoardData const wdl_2 = e8|f7|g6|h5
 The white diagonal from e8 to h5.
 
BitBoardData const wdl_3 = c8|d7|e6|f5|g4|h3
 The white diagonal from c8 to h3.
 
BitBoardData const wdl_4 = a8|b7|c6|d5|e4|f3|g2|h1
 The white diagonal from a8 to h1.
 
BitBoardData const wdl_5 = a6|b5|c4|d3|e2|f1
 The white diagonal from a6 to f1.
 
BitBoardData const wdl_6 = a4|b3|c2|d1
 The white diagonal from a4 to d1.
 
BitBoardData const wdl_7 = a2|b1
 The white diagonal from a2 to b1.
 
uint8_t const black_rook_queen_side_moved = 1
 
uint8_t const black_rook_king_side_moved = 2
 
uint8_t const black_king_moved = 4
 
uint8_t const black_king_in_check = 8
 
uint8_t const white_king_in_check = 16
 
uint8_t const white_rook_queen_side_moved = 32
 
uint8_t const white_rook_king_side_moved = 64
 
uint8_t const white_king_moved = 128
 
CodeData const white_pawn = { white_bits | pawn_bits }
 A constant representing a white pawn.
 
CodeData const white_rook = { white_bits | rook_bits }
 A constant representing a white rook.
 
CodeData const white_knight = { white_bits | knight_bits }
 A constant representing a white knight.
 
CodeData const white_bishop = { white_bits | bishop_bits }
 A constant representing a white bishop.
 
CodeData const white_queen = { white_bits | queen_bits }
 A constant representing a white queen.
 
CodeData const white_king = { white_bits | king_bits }
 A constant representing a white king.
 
CodeData const black_pawn = { black_bits | pawn_bits }
 A constant representing a black pawn.
 
CodeData const black_rook = { black_bits | rook_bits }
 A constant representing a black rook;.
 
CodeData const black_knight = { black_bits | knight_bits }
 A constant representing a black knight;.
 
CodeData const black_bishop = { black_bits | bishop_bits }
 A constant representing a black bishop;.
 
CodeData const black_queen = { black_bits | queen_bits }
 A constant representing a black queen;.
 
CodeData const black_king = { black_bits | king_bits }
 A constant representing a black king;.
 
uint8_t const black_bits = 0
 The underlaying integral value of color 'black'.
 
uint8_t const white_bits = 8
 The underlaying integral value of color 'white'.
 
uint8_t const color_mask = 8
 A mask for the bits used for the color of a piece.
 
ColorData const black = { black_bits }
 A constant representing the color black.
 
ColorData const white = { white_bits }
 A constant representing the color white.
 
BitBoardData const from_to_table [64* 64]
 
uint8_t const direction_index_table [256]
 
uint8_t const df_rook_mover = rook_bits
 
uint8_t const df_bishop_mover = bishop_bits
 
uint8_t const df_pinned_horizontally = 0 << 3
 
uint8_t const df_pinned_vertically = 1 << 3
 
uint8_t const df_pinned_slashy = 2 << 3
 
uint8_t const df_pinned_backslashy = 3 << 3
 
uint8_t const df_pinned_mask = 3 << 3
 
Direction const south_west = { 9, -9, 0, df_bishop_mover | df_pinned_slashy }
 
Direction const south = { 8, -8, 1, df_rook_mover | df_pinned_vertically }
 
Direction const south_east = { 7, -7, 2, df_bishop_mover | df_pinned_backslashy }
 
Direction const west = { 1, -1, 3, df_rook_mover | df_pinned_horizontally }
 
Direction const east = { 1, 1, 4, df_rook_mover | df_pinned_horizontally }
 
Direction const north_west = { 7, 7, 5, df_bishop_mover | df_pinned_backslashy }
 
Direction const north = { 8, 8, 6, df_rook_mover | df_pinned_vertically }
 
Direction const north_east = { 9, 9, 7, df_bishop_mover | df_pinned_slashy }
 
FlagsData const fl_none = { 0 }
 
uint8_t const fl_pawn_mask = { 120 }
 
FlagsData const fl_pawn_can_take_queen_side = { 8 }
 A constant representing the flag 'pawn can take queen side'.
 
FlagsData const fl_pawn_is_not_blocked = { 16 }
 A constant representing the flag 'pawn is not blocked'.
 
FlagsData const fl_pawn_can_take_king_side = { 32 }
 A constant representing the flag 'pawn can take king side'.
 
FlagsData const fl_pawn_can_move_two_squares = { 64 }
 A constant representing the flag 'pawn can move two squares'.
 
uint8_t const col_mask = 0x07
 A mask for the bits used for the column in IndexData.
 
uint8_t const row_mask = 0x38
 A mask for the bits used for the row in IndexData.
 
IndexData const ia1 = { 0 }
 A constant representing the index to square a1.
 
IndexData const ib1 = { 1 }
 A constant representing the index to square b1.
 
IndexData const ic1 = { 2 }
 A constant representing the index to square c1.
 
IndexData const id1 = { 3 }
 A constant representing the index to square d1.
 
IndexData const ie1 = { 4 }
 A constant representing the index to square e1.
 
IndexData const if1 = { 5 }
 A constant representing the index to square f1.
 
IndexData const ig1 = { 6 }
 A constant representing the index to square g1.
 
IndexData const ih1 = { 7 }
 A constant representing the index to square h1.
 
IndexData const ia2 = { 8 }
 A constant representing the index to square a2.
 
IndexData const ib2 = { 9 }
 A constant representing the index to square b2.
 
IndexData const ic2 = { 10 }
 A constant representing the index to square c2.
 
IndexData const id2 = { 11 }
 A constant representing the index to square d2.
 
IndexData const ie2 = { 12 }
 A constant representing the index to square e2.
 
IndexData const if2 = { 13 }
 A constant representing the index to square f2.
 
IndexData const ig2 = { 14 }
 A constant representing the index to square g2.
 
IndexData const ih2 = { 15 }
 A constant representing the index to square h2.
 
IndexData const ia3 = { 16 }
 A constant representing the index to square a3.
 
IndexData const ib3 = { 17 }
 A constant representing the index to square b3.
 
IndexData const ic3 = { 18 }
 A constant representing the index to square c3.
 
IndexData const id3 = { 19 }
 A constant representing the index to square d3.
 
IndexData const ie3 = { 20 }
 A constant representing the index to square e3.
 
IndexData const if3 = { 21 }
 A constant representing the index to square f3.
 
IndexData const ig3 = { 22 }
 A constant representing the index to square g3.
 
IndexData const ih3 = { 23 }
 A constant representing the index to square h3.
 
IndexData const ia4 = { 24 }
 A constant representing the index to square a4.
 
IndexData const ib4 = { 25 }
 A constant representing the index to square b4.
 
IndexData const ic4 = { 26 }
 A constant representing the index to square c4.
 
IndexData const id4 = { 27 }
 A constant representing the index to square d4.
 
IndexData const ie4 = { 28 }
 A constant representing the index to square e4.
 
IndexData const if4 = { 29 }
 A constant representing the index to square f4.
 
IndexData const ig4 = { 30 }
 A constant representing the index to square g4.
 
IndexData const ih4 = { 31 }
 A constant representing the index to square h4.
 
IndexData const ia5 = { 32 }
 A constant representing the index to square a5.
 
IndexData const ib5 = { 33 }
 A constant representing the index to square b5.
 
IndexData const ic5 = { 34 }
 A constant representing the index to square c5.
 
IndexData const id5 = { 35 }
 A constant representing the index to square d5.
 
IndexData const ie5 = { 36 }
 A constant representing the index to square e5.
 
IndexData const if5 = { 37 }
 A constant representing the index to square f5.
 
IndexData const ig5 = { 38 }
 A constant representing the index to square g5.
 
IndexData const ih5 = { 39 }
 A constant representing the index to square h5.
 
IndexData const ia6 = { 40 }
 A constant representing the index to square a6.
 
IndexData const ib6 = { 41 }
 A constant representing the index to square b6.
 
IndexData const ic6 = { 42 }
 A constant representing the index to square c6.
 
IndexData const id6 = { 43 }
 A constant representing the index to square d6.
 
IndexData const ie6 = { 44 }
 A constant representing the index to square e6.
 
IndexData const if6 = { 45 }
 A constant representing the index to square f6.
 
IndexData const ig6 = { 46 }
 A constant representing the index to square g6.
 
IndexData const ih6 = { 47 }
 A constant representing the index to square h6.
 
IndexData const ia7 = { 48 }
 A constant representing the index to square a7.
 
IndexData const ib7 = { 49 }
 A constant representing the index to square b7.
 
IndexData const ic7 = { 50 }
 A constant representing the index to square c7.
 
IndexData const id7 = { 51 }
 A constant representing the index to square d7.
 
IndexData const ie7 = { 52 }
 A constant representing the index to square e7.
 
IndexData const if7 = { 53 }
 A constant representing the index to square f7.
 
IndexData const ig7 = { 54 }
 A constant representing the index to square g7.
 
IndexData const ih7 = { 55 }
 A constant representing the index to square h7.
 
IndexData const ia8 = { 56 }
 A constant representing the index to square a8.
 
IndexData const ib8 = { 57 }
 A constant representing the index to square b8.
 
IndexData const ic8 = { 58 }
 A constant representing the index to square c8.
 
IndexData const id8 = { 59 }
 A constant representing the index to square d8.
 
IndexData const ie8 = { 60 }
 A constant representing the index to square e8.
 
IndexData const if8 = { 61 }
 A constant representing the index to square f8.
 
IndexData const ig8 = { 62 }
 A constant representing the index to square g8.
 
IndexData const ih8 = { 63 }
 A constant representing the index to square h8.
 
IndexData const index_pre_begin = { 255 }
 A constant representing 'one before the start'.
 
IndexData const index_begin = { 0 }
 A constant representing the 'first' index.
 
IndexData const index_end = { 64 }
 A constant representing 'one past the end'.
 
uint8_t const nothing_bits = 0
 The underlaying integral value of type 'nothing'.
 
uint8_t const pawn_bits = 1
 The underlaying integral value of type 'pawn'.
 
uint8_t const knight_bits = 2
 The underlaying integral value of type 'knight'.
 
uint8_t const king_bits = 3
 The underlaying integral value of type 'king'.
 
uint8_t const bishop_bits = 5
 The underlaying integral value of type 'bishop'.
 
uint8_t const rook_bits = 6
 The underlaying integral value of type 'rook'.
 
uint8_t const queen_bits = 7
 The underlaying integral value of type 'queen'.
 
uint8_t const type_mask = 7
 A mask for the bits used for the type of a piece.
 
TypeData const nothing = { nothing_bits }
 A constant representing the absence of a piece.
 
TypeData const pawn = { pawn_bits }
 A constant representing a pawn.
 
TypeData const knight = { knight_bits }
 A constant representing a knight.
 
TypeData const king = { king_bits }
 A constant representing a king.
 
TypeData const bishop = { bishop_bits }
 A constant representing a bishop.
 
TypeData const rook = { rook_bits }
 A constant representing a rook.
 
TypeData const queen = { queen_bits }
 A constant representing a queen.
 

Detailed Description

A namespace for all chess related objects that are not related to the GUI.

Typedef Documentation

typedef uint64_t cwchess::mask_t

The type of an internal BitBoard mask.

Don't use this, use BitBoard .

Definition at line 48 of file BitBoard.h.

Function Documentation

Index cwchess::mask2index ( mask_t  mask)
inline

Convert a single bit mask into it's Index.

The provided mask should have a single bit set. However, if that is not the case, then this function returns either 64 if no bit is set, or the index of the first (least significant) bit that is set.

Definition at line 69 of file BitBoard.h.

References index_pre_begin, and cwchess::Index::next_bit_in().

Referenced by cwchess::ChessPosition::defendables(), cwchess::ChessPosition::index_of_king(), cwchess::ChessPosition::moves(), cwchess::ChessPosition::place(), and cwchess::ChessPosition::set_en_passant().

Variable Documentation

uint8_t const cwchess::direction_index_table
Initial value:
= {
0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x06, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05,
0x06, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x08,
0x06, 0x08, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x08, 0x08,
0x06, 0x08, 0x08, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x08, 0x08, 0x08,
0x06, 0x08, 0x08, 0x08, 0x08, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x08, 0x08, 0x08, 0x08,
0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x08, 0x08, 0x08, 0x05, 0x08, 0x08, 0x08, 0x08, 0x08,
0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x08, 0x05, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x01, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x02, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x01, 0x08, 0x08, 0x08, 0x08, 0x08, 0x02, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08,
0x01, 0x08, 0x08, 0x08, 0x08, 0x02, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08,
0x01, 0x08, 0x08, 0x08, 0x02, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08,
0x01, 0x08, 0x08, 0x02, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08,
0x01, 0x08, 0x02, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08,
0x01, 0x02, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00
}

Definition at line 1190 of file Direction.cc.


Copyright © 2006 - 2010 Carlo Wood.  All rights reserved.