Compare commits
2 Commits
e7d69d7ce4
...
96c342b3d4
| Author | SHA1 | Date | |
|---|---|---|---|
| 96c342b3d4 | |||
| c90cc39383 |
@@ -10,3 +10,12 @@ r2bkb1r/8/8/8/8/3bb3/8/R2BKB1R w KQkq - 0 1
|
||||
# illegal positions
|
||||
4k3/8/8/8/7b/8/8/4K3 b - - 0 1
|
||||
2r1k3/3P4/8/8/8/8/8/4K3 w - - 0 1
|
||||
|
||||
# only kings on A1/H8
|
||||
k7/8/8/8/8/8/8/K7 b - - 0 1
|
||||
|
||||
# only one move possible (Pf2xBg3)
|
||||
k7/8/8/1p1p4/pPpPp3/P1PpPpb1/NBNP1P2/KBB1B3 w - - 0 1
|
||||
|
||||
# only 2 moves possible (Ph5xg6 e.p., Ph5-h6)
|
||||
k7/8/8/1p1p2pP/pPpPp3/P1PpPp2/NBNP1P2/KBB1B3 w - g6 0 1
|
||||
|
||||
@@ -53,6 +53,7 @@ int do_fen(pos_t *, char*);
|
||||
int do_pos(pos_t *, char*);
|
||||
int do_genmoves(pos_t *, char*);
|
||||
int do_prmoves(pos_t *, char*);
|
||||
int do_prmovepos(pos_t *pos, char *arg);
|
||||
int do_memstats(pos_t *, char*);
|
||||
int do_eval(pos_t *, char*);
|
||||
int do_quit(pos_t *, char*);
|
||||
@@ -65,7 +66,8 @@ COMMAND commands[] = {
|
||||
{ "pos", do_pos, "Print current position" },
|
||||
{ "quit", do_quit, "Quit" },
|
||||
{ "genmove", do_genmoves, "Generate next move list" },
|
||||
{ "prmoves", do_prmoves, "Generate next move list" },
|
||||
{ "prmoves", do_prmoves, "Print position move list" },
|
||||
{ "prmovepos", do_prmovepos, "Print Nth move resulting position" },
|
||||
{ "memstats", do_memstats, "Generate next move list" },
|
||||
{ "eval", do_eval, "Eval current position" },
|
||||
{ "debug", do_debug, "Set log level to LEVEL" },
|
||||
@@ -288,6 +290,22 @@ int do_prmoves(pos_t *pos,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_prmovepos(pos_t *pos, char *arg)
|
||||
{
|
||||
struct list_head *p_cur, *tmp;
|
||||
int movenum = atoi(arg), cur = 0; /* starts with 0 */
|
||||
move_t *move;
|
||||
|
||||
log_f(1, "%s\n", arg);
|
||||
list_for_each_safe(p_cur, tmp, &pos->moves) {
|
||||
move = list_entry(p_cur, move_t, list);
|
||||
if (cur++ == movenum)
|
||||
break;
|
||||
}
|
||||
pos_print(move->newpos);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int do_memstats(__attribute__((unused)) pos_t *pos,
|
||||
__attribute__((unused)) char *arg)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user