My Project
move.h
Go to the documentation of this file.
1
11#ifndef EDAX_MOVE_H
12#define EDAX_MOVE_H
13
14#include "const.h"
15
16#include <stdio.h>
17#include <stdbool.h>
18
20typedef struct Move {
21 unsigned long long flipped;
22 int x;
23 int score;
24 unsigned int cost;
25 struct Move *next;
27
29typedef struct MoveList {
33
35typedef struct Line {
38 int color;
40
41struct Search;
42struct HashData;
43struct Board;
44
45/* useful constants */
46extern const Move MOVE_INIT;
47extern const Move MOVE_PASS;
48
49
50/* function declarations */
51int symetry(int, const int);
52
53void move_print(const int, const int, FILE*);
54bool move_wipeout(const Move*, const struct Board*);
57char* move_to_string(const int, const int, char*);
58
59void tune_move_evaluate(struct Search*, const char*, const char*);
60
61int movelist_get_moves(MoveList*, const struct Board*);
62void movelist_print(const MoveList*, const int, FILE*);
64void movelist_evaluate(MoveList*, struct Search*, const struct HashData*, const int, const int);
68
69Move* movelist_exclude(MoveList*, const int);
71
73void movelist_sort_cost(MoveList*, const struct HashData*);
74bool movelist_is_empty(const MoveList*);
76
78#define foreach_move(iter, movelist) \
79 for ((iter) = (movelist)->move->next; (iter); (iter) = (iter)->next)
80
82#define foreach_best_move(iter, movelist) \
83 for ((iter) = movelist_best(movelist); (iter); (iter) = move_next_best(iter))
84
85void line_init(Line*, const int);
86void line_push(Line*, const int);
87void line_pop(Line*);
88void line_copy(Line*, const Line*, const int);
89void line_print(const Line*, int, const char*, FILE*);
90char* line_to_string(const Line *line, int n, const char*, char *string);
91
93typedef struct MoveHash {
95 int size;
96 int mask;
98void movehash_init(MoveHash*, int);
100bool movehash_append(MoveHash*, const struct Board*, const int);
101
102#endif
103
#define GAME_SIZE
Definition: const.h:25
#define MAX_MOVE
Definition: const.h:18
char * line_to_string(const Line *line, int n, const char *, char *string)
Line to string.
Definition: move.c:635
bool move_wipeout(const Move *, const struct Board *)
void line_pop(Line *)
Remove the last move from a sequence.
Definition: move.c:578
Move * move_next_best(Move *)
Return the next best move from the list.
Definition: move.c:346
bool movehash_append(MoveHash *, const struct Board *, const int)
void movelist_restore(MoveList *, Move *)
const Move MOVE_PASS
Definition: move.c:26
void movehash_init(MoveHash *, int)
Initialisation of the hash table.
Definition: move.c:715
void line_init(Line *, const int)
Initialize a sequence of moves.
Definition: move.c:549
Move * move_next(Move *)
Return the next move from the list.
Definition: move.c:400
void movehash_delete(MoveHash *)
Free the hash table.
Definition: move.c:730
void move_print(const int, const int, FILE *)
Print out a move.
Definition: move.c:110
bool movelist_is_single(const MoveList *)
void tune_move_evaluate(struct Search *, const char *, const char *)
Move * movelist_best(MoveList *)
Return the best move of the list.
Definition: move.c:411
bool movelist_is_empty(const MoveList *)
Check if the list is empty.
Definition: move.c:537
void line_print(const Line *, int, const char *, FILE *)
Print a move sequence.
Definition: move.c:610
Move * movelist_sort_bestmove(MoveList *, const int)
Sort a move as best.
Definition: move.c:468
char * move_to_string(const int, const int, char *)
Print out a move.
Definition: move.c:76
void movelist_evaluate(MoveList *, struct Search *, const struct HashData *, const int, const int)
void line_push(Line *, const int)
Add a move to the sequence.
Definition: move.c:561
int movelist_get_moves(MoveList *, const struct Board *)
void movelist_sort_cost(MoveList *, const struct HashData *)
void movelist_print(const MoveList *, const int, FILE *)
Print out a movelist.
Definition: move.c:330
Move * movelist_exclude(MoveList *, const int)
Exclude a move.
Definition: move.c:516
void line_copy(Line *, const Line *, const int)
Copy part of a sequence to another sequence.
Definition: move.c:591
void movelist_sort(MoveList *)
Sort all moves.
Definition: move.c:505
int symetry(int, const int)
Get a symetric square coordinate.
Definition: move.c:47
const Move MOVE_INIT
Definition: move.c:25
Move * movelist_first(MoveList *)
Return the first move of the list.
Definition: move.c:422
void movelist_evaluate_fast(MoveList *, struct Search *)
Definition: board.h:26
Definition: hash.h:24
Definition: move.h:35
int n_moves
Definition: move.h:37
char move[GAME_SIZE]
Definition: move.h:36
int color
Definition: move.h:38
Definition: move.c:661
Definition: move.h:93
int mask
Definition: move.h:96
int size
Definition: move.h:95
struct MoveArray * array
Definition: move.h:94
Definition: move.h:29
int n_moves
Definition: move.h:31
Move move[MAX_MOVE+2]
Definition: move.h:30
Definition: move.h:20
unsigned int cost
Definition: move.h:24
int score
Definition: move.h:23
struct Move * next
Definition: move.h:25
unsigned long long flipped
Definition: move.h:21
int x
Definition: move.h:22
Definition: search.h:95