⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 move.h

📁 超强国际象棋引擎
💻 H
字号:
// move.h

#ifndef MOVE_H

#define MOVE_H

// includes

#include "board.h"

// constants

const char null_move_string [] = "null"; // "0000" in UCI

// macros

#define MOVE_MAKE(from,to)             ((SQUARE_TO_64(from)<<6)|SQUARE_TO_64(to))
#define MOVE_MAKE_FLAGS(from,to,flags) ((SQUARE_TO_64(from)<<6)|SQUARE_TO_64(to)|(flags))

#define MOVE_FROM(move)                (SQUARE_FROM_64(((move)>>6)&077))
#define MOVE_TO(move)                  (SQUARE_FROM_64((move)&077))

#define MOVE_IS_SPECIAL(move)          (((move)&(3 << 14))!=(0 << 14))
#define MOVE_IS_PROMOTE(move)          (((move)&(3 << 14))==(2 << 14))
#define MOVE_IS_EN_PASSANT(move)       (((move)&(3 << 14))==(3 << 14))
#define MOVE_IS_CASTLE(move)           (((move)&(3 << 14))==(1 << 14))

#define MOVE_PIECE(move,board)         ((board)->square[MOVE_FROM(move)])

// types

typedef uint16 mv_t;

// functions

extern bool move_is_ok(int move);

extern int move_promote(int move);

extern int move_order(int move);

extern bool move_is_capture(int move, const board_t *board);
extern bool move_is_under_promote(int move);
extern bool move_is_tactical(int move, const board_t *board);

extern int move_capture(int move, const board_t *board);

extern bool move_to_string(int move, char string [], int size);
extern int move_from_string(const char string [], const board_t *board);

#endif // !defined MOVE_H

// end of move.h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -