File: game.h

package info (click to toggle)
polyglot 2.0.1%2Bgit20140926-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,228 kB
  • ctags: 1,163
  • sloc: ansic: 10,416; sh: 994; makefile: 18
file content (73 lines) | stat: -rw-r--r-- 1,397 bytes parent folder | download | duplicates (5)
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
62
63
64
65
66
67
68
69
70
71
72
73

// game.h

#ifndef GAME_H
#define GAME_H

// includes

#include "board.h"
#include "move.h"
#include "util.h"

// defines

#define GameSize 4096

// types

typedef enum {
   PLAYING,
   WHITE_MATES,
   BLACK_MATES,
   STALEMATE,
   DRAW_MATERIAL,
   DRAW_FIFTY,
   DRAW_REPETITION
} status_t;

// types

typedef struct {
   board_t start_board[1];
   board_t board[1];
   sint16 size;
   sint16 pos;
   sint8 status;
   move_t move[GameSize];
   uint64 key[GameSize];
} game_t;

// variables

extern game_t Game[1];

// functions

extern bool game_is_ok     (const game_t * game);

extern void game_clear     (game_t * game);
extern bool game_init      (game_t * game, const char fen[]);

extern int  game_status    (const game_t * game);

extern int  game_size      (const game_t * game);
extern int  game_pos       (const game_t * game);
extern int  game_move      (const game_t * game, int pos);

extern void game_get_board (const game_t * game, board_t * board);
extern void game_get_board_ex (const game_t * game, board_t * board, int pos);
extern int  game_turn      (const game_t * game);
extern int  game_move_nb   (const game_t * game);

extern void game_add_move  (game_t * game, int move);
extern void game_rem_move  (game_t * game);

extern void game_goto      (game_t * game, int pos);

extern void game_disp      (const game_t * game);

#endif // !defined GAME_H

// end of game.h