movegen: add pos_gen_legal() to simplify code
This commit is contained in:
4
Makefile
4
Makefile
@@ -102,7 +102,7 @@ endif
|
|||||||
# if no version, use last commit and date.
|
# if no version, use last commit and date.
|
||||||
# else, if last commit != last tag commit, add commit and date to version number
|
# else, if last commit != last tag commit, add commit and date to version number
|
||||||
ifeq ($(VERSION),)
|
ifeq ($(VERSION),)
|
||||||
VERSION := $(build)-$(COMMIT)-$(DATE)
|
VERSION := $(build)-git.$(COMMIT)-$(DATE)
|
||||||
else ifneq ($(COMMIT), $(TAG_COMMIT))
|
else ifneq ($(COMMIT), $(TAG_COMMIT))
|
||||||
VERSION := $(VERSION)-next-$(build)-$(COMMIT)-$(DATE)
|
VERSION := $(VERSION)-next-$(build)-$(COMMIT)-$(DATE)
|
||||||
endif
|
endif
|
||||||
@@ -415,7 +415,7 @@ TEST += movedo-test perft-test tt-test
|
|||||||
PIECE_OBJS := piece.o
|
PIECE_OBJS := piece.o
|
||||||
FEN_OBJS := $(PIECE_OBJS) fen.o position.o bitboard.o board.o \
|
FEN_OBJS := $(PIECE_OBJS) fen.o position.o bitboard.o board.o \
|
||||||
hq.o attack.o hash.o init.o util.o alloc.o move.o \
|
hq.o attack.o hash.o init.o util.o alloc.o move.o \
|
||||||
eval.o eval-defs.o eval-simple.o
|
eval.o eval-defs.o eval-simple.o hist.o
|
||||||
BB_OBJS := $(FEN_OBJS)
|
BB_OBJS := $(FEN_OBJS)
|
||||||
MOVEGEN_OBJS := $(BB_OBJS) move-gen.o
|
MOVEGEN_OBJS := $(BB_OBJS) move-gen.o
|
||||||
ATTACK_OBJS := $(MOVEGEN_OBJS)
|
ATTACK_OBJS := $(MOVEGEN_OBJS)
|
||||||
|
@@ -480,3 +480,18 @@ finish:
|
|||||||
return movelist;
|
return movelist;
|
||||||
//return movelist->nmoves = moves - movelist->move;
|
//return movelist->nmoves = moves - movelist->move;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pos_gen_legal() - generate position legal moves
|
||||||
|
* @pos: position
|
||||||
|
* @movelist: &movelist_t array to store moves
|
||||||
|
*
|
||||||
|
* Generate all @pos legal moves for player-to-move.
|
||||||
|
* @movelist is filled with the moves.
|
||||||
|
*
|
||||||
|
* @Return: movelist
|
||||||
|
*/
|
||||||
|
movelist_t *pos_gen_legal(pos_t *pos, movelist_t *movelist)
|
||||||
|
{
|
||||||
|
return pos_legal(pos, pos_gen_pseudo(pos, movelist));
|
||||||
|
}
|
||||||
|
@@ -27,5 +27,6 @@ movelist_t *pos_legal_dup(const pos_t *pos, movelist_t *pseudo, movelist_t *lega
|
|||||||
movelist_t *pos_legal(const pos_t *pos, movelist_t *list);
|
movelist_t *pos_legal(const pos_t *pos, movelist_t *list);
|
||||||
|
|
||||||
movelist_t *pos_gen_pseudo(pos_t *pos, movelist_t *movelist);
|
movelist_t *pos_gen_pseudo(pos_t *pos, movelist_t *movelist);
|
||||||
|
movelist_t *pos_gen_legal(pos_t *pos, movelist_t *movelist);
|
||||||
|
|
||||||
#endif /* MOVEGEN_H */
|
#endif /* MOVEGEN_H */
|
||||||
|
Reference in New Issue
Block a user