CPW-Engine_0x88_math


 * Home * Engines * CPW-Engine * 0x88_math**

code format="cpp" /* row identifiers */ /* column identifiers */ /* vectors */
 * 1) define ROW_1  ( A1 >> 4 )
 * 2) define ROW_2  ( A2 >> 4 )
 * 3) define ROW_3  ( A3 >> 4 )
 * 4) define ROW_4  ( A4 >> 4 )
 * 5) define ROW_5  ( A5 >> 4 )
 * 6) define ROW_6  ( A6 >> 4 )
 * 7) define ROW_7  ( A7 >> 4 )
 * 8) define ROW_8  ( A8 >> 4 )
 * 1) define COL_A ( A1 & 7 )
 * 2) define COL_B ( B1 & 7 )
 * 3) define COL_C ( C1 & 7 )
 * 4) define COL_D ( D1 & 7 )
 * 5) define COL_E ( E1 & 7 )
 * 6) define COL_F ( F1 & 7 )
 * 7) define COL_G ( G1 & 7 )
 * 8) define COL_H ( H1 & 7 )
 * 1) define NORTH 16
 * 2) define NN   ( NORTH + NORTH )
 * 3) define SOUTH -16
 * 4) define SS   ( SOUTH + SOUTH )
 * 5) define EAST 1
 * 6) define WEST -1
 * 7) define NE   17
 * 8) define SW   -17
 * 9) define NW   15
 * 10) define SE   -15

/* geberate square number from row and column */
 * 1) define SET_SQ(row,col) (row * 16 + col)

/* does a given number represent a square on the board? */
 * 1) define IS_SQ(x) ( (x) & 0x88 ) ? (0) : (1)

/* get board column that a square is part of */ /* get board row that a square is part of */
 * 1) define COL(sq) ( (sq) & 7 )
 * 1) define ROW(sq) ( (sq) >> 4 )

/* determine if two squares lie on the same column */
 * 1) define SAME_COL(sq1,sq2) ( ( COL(sq1) == COL(sq2) ) ? (1) : (0) )

/* determine if two squares lie in the same row */ code =What links here?= include page="CPW-Engine_0x88_math" component="backlinks" limit="10"
 * 1) define SAME_ROW(sq1,sq2) ( ( ROW(sq1) == ROW(sq2) ) ? (1) : (0) )
 * Up one Level**