bb migration: add util, update fen/fen-test + partial pos + piece
This commit is contained in:
51
src/piece.h
51
src/piece.h
@@ -1,6 +1,6 @@
|
||||
/* piece.h - piece definitions.
|
||||
*
|
||||
* Copyright (C) 2021 Bruno Raoult ("br")
|
||||
* Copyright (C) 2021-2024 Bruno Raoult ("br")
|
||||
* Licensed under the GNU General Public License v3.0 or later.
|
||||
* Some rights reserved. See COPYING.
|
||||
*
|
||||
@@ -20,16 +20,17 @@
|
||||
#include "list.h"
|
||||
#include "pool.h"
|
||||
|
||||
#define PIECE_DEFAULT_VALUE 0
|
||||
|
||||
/* initial default values */
|
||||
#define PAWN_VALUE 100
|
||||
#define KNIGHT_VALUE 300
|
||||
#define BISHOP_VALUE 300
|
||||
#define ROOK_VALUE 500
|
||||
#define QUEEN_VALUE 900
|
||||
#define EMPTY_VALUE 0
|
||||
#define PAWN_VALUE 100
|
||||
#define KNIGHT_VALUE 300
|
||||
#define BISHOP_VALUE 300
|
||||
#define ROOK_VALUE 500
|
||||
#define QUEEN_VALUE 900
|
||||
#define KING_VALUE 20000
|
||||
|
||||
/*
|
||||
typedef struct piece_list_s {
|
||||
piece_t piece;
|
||||
square_t square;
|
||||
@@ -37,35 +38,39 @@ typedef struct piece_list_s {
|
||||
s64 value;
|
||||
struct list_head list;
|
||||
} piece_list_t;
|
||||
*/
|
||||
|
||||
/* some default values for pieces
|
||||
*/
|
||||
extern struct piece_details {
|
||||
extern const struct piece_details {
|
||||
char abbrev_w; /* used for game notation */
|
||||
char abbrev_b;
|
||||
char *symbol_w;
|
||||
char *symbol_b; /* used for game notation */
|
||||
char *name;
|
||||
s64 value;
|
||||
s64 opn_value;
|
||||
s64 mid_value;
|
||||
s64 end_value;
|
||||
} piece_details[];
|
||||
|
||||
#define P_NAME(p) piece_details[E_PIECE(p)].name
|
||||
#define P_LETTER(p) piece_details[E_PIECE(p)].abbrev_w
|
||||
#define P_SYM(p) piece_details[E_PIECE(p)].symbol_b
|
||||
#define P_CSHORT(p) (IS_WHITE(p)? piece_details[E_PIECE(p)].abbrev_w: \
|
||||
piece_details[E_PIECE(p)].abbrev_b)
|
||||
#define P_CSYM(p) (IS_WHITE(p)? piece_details[E_PIECE(p)].symbol_w: \
|
||||
piece_details[E_PIECE(p)].symbol_b)
|
||||
#define P_VALUE(p) (piece_details[E_PIECE(p)].value)
|
||||
#define P_NAME(p) piece_details[PIECE(p)].name
|
||||
#define P_LETTER(p) piece_details[PIECE(p)].abbrev_w
|
||||
#define P_SYM(p) piece_details[PIECE(p)].symbol_b
|
||||
#define P_CSHORT(p) (IS_WHITE(p)? piece_details[PIECE(p)].abbrev_w: \
|
||||
piece_details[PIECE(p)].abbrev_b)
|
||||
#define P_CSYM(p) (IS_WHITE(p)? piece_details[PIECE(p)].symbol_w: \
|
||||
piece_details[PIECE(p)].symbol_b)
|
||||
#define P_VALUE(p) (piece_details[PIECE(p)].value)
|
||||
|
||||
/* use short name or symbol - no effect
|
||||
*/
|
||||
#define P_USE_UTF 1
|
||||
|
||||
void piece_list_print(struct list_head *list);
|
||||
pool_t *piece_pool_init();
|
||||
void piece_pool_stats();
|
||||
piece_list_t *piece_add(pos_t *pos, piece_t piece, square_t square);
|
||||
void piece_del(struct list_head *ptr);
|
||||
int pieces_del(pos_t *pos, short color);
|
||||
//void piece_list_print(struct list_head *list);
|
||||
//pool_t *piece_pool_init();
|
||||
//void piece_pool_stats();
|
||||
//piece_list_t *piece_add(pos_t *pos, piece_t piece, square_t square);
|
||||
//void piece_del(struct list_head *ptr);
|
||||
//int pieces_del(pos_t *pos, short color);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user