aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/movecheck.h
blob: f1a22ac477c4e9aec6fc7be9ee29e96203073a88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* movecheck.h
 *
 */

/*
    fics - An internet chess server.
    Copyright (C) 1993  Richard V. Nash

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
*/

/* Revision history:
   name		email		yy/mm/dd	Change
   Richard Nash	              	93/10/22	Created
*/

#ifndef _MOVECHECK_H
#define _MOVECHECK_H

#define MOVE_OK          0
#define MOVE_ILLEGAL     1
#define MOVE_STALEMATE   2
#define MOVE_CHECKMATE   3
#define MOVE_AMBIGUOUS   4
#define MOVE_NOMATERIAL  5

#define MS_NOTMOVE       0
#define MS_COMP          1
#define MS_COMPDASH      2
#define MS_ALG           3
#define MS_KCASTLE       4
#define MS_QCASTLE       5

#define isrank(c) (((c) <= '8') && ((c) >= '1'))
#define isfile(c) (((c) >= 'a') && ((c) <= 'h'))

#if !defined(_BOARD_H)
#include "board.h"
#endif

extern int is_move(char *);
extern int parse_move(char *, game_state_t *, move_t *, int);
extern int execute_move(game_state_t *, move_t *, int);
extern int backup_move(int, int);

/* Some useful chess utilities */
extern int NextPieceLoop(board_t, int *, int *, int);
extern int InitPieceLoop(board_t, int *, int *, int);
extern int legal_move(game_state_t *, int, int, int, int);
extern int legal_andcheck_move(game_state_t *, int, int, int, int);
extern int in_check(game_state_t *);

#endif /* _MOVECHECK_H */