-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolver.h
More file actions
64 lines (55 loc) · 1.67 KB
/
Copy pathsolver.h
File metadata and controls
64 lines (55 loc) · 1.67 KB
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
/****************************************************************************\
* solver.h *
* *
* Author: F. Engelbrecht *
\****************************************************************************/
#ifndef SOLVER_H_
#define SOLVER_H_
/****************************************************************************\
* Structures *
\****************************************************************************/
typedef struct wight_list_t
{
short value, wight;
struct wight_list_t *next;
} wl;
typedef struct move_list_t
{
char move;
struct move_list_t *next;
} ml;
typedef struct best_case_list_t
{
short **board;
short weight, moves;
char blank_y, blank_x;
struct best_case_list_t *next;
ml *move_list;
} bcl;
/****************************************************************************\
* Prototypes *
\****************************************************************************/
void solve(bcl **start);
bcl *get_bcl(bcl **start);
bcl *move_up(bcl **start);
bcl *move_down(bcl **start);
bcl *move_left(bcl **start);
bcl *move_right(bcl **start);
char add_bcl(bcl **head, bcl **poss);
char get_board_size(FILE *pFile);
void free_bcl(bcl **head);
void free_board(short **board);
void free_move_list(ml *move_list);
short get_board_weight(short **board);
short pop_wight_list(wl **top, short value);
char check_state(short **board);
short **cpy_board(short **board);
void result(short **board, ml *list, char *y, char *x, char boolean,
FILE *pFile);
void store_board(short **board, FILE *pFile);
void print_board(short **board);
char size;
int name;
short beat;
short *MAXMOVES;
#endif /* SOLVER_H_ */