Implement :
[Project_algorithmic_C.git] / lib / othello.h
CommitLineData
4ddf6f1a
JB
1/*
2 * =====================================================================================
3 *
4 * Filename: othello.h
5 *
6 * Description: Header for othello board handling functions
7 *
8 * Version: 1.0
9 * Created: 25/04/2017 15:16:37
10 * Revision: none
11 * Compiler: gcc
12 *
13 * Author: Jerome Benoit (fraggle), jerome.benoit@piment-noir.org
14 * Organization: Piment Noir
15 *
16 * =====================================================================================
17 */
18
19#ifndef OTHELLO_H
20#define OTHELLO_H
21
2e5c1894 22#include "constants.h"
54f1c58c 23#include "list.h"
2e5c1894 24
45ce2fe3
JB
25/* TODO: must be used to replace the explicit pawns 2D array */
26struct pawns_s {
27 unsigned int pawns[board_size][board_size];
28};
29
30/* linked list of played shots */
31struct shots_history_list_s {
32 struct list_head list;
33 unsigned int*** pawn_array_member; /* pointer to a cell of the pawns 2D array */
34 /* struct* pawns_s pawn */
35};
36
37/* linked list of can play shots */
38struct shots_exploration_s {
54f1c58c 39 struct list_head list;
45ce2fe3
JB
40 int y;
41 int x;
42 unsigned int type;
54f1c58c 43};
74e2b93b
JB
44
45unsigned int current_player(unsigned int round_count);
a8b54576 46unsigned int eval_winner(unsigned int nb_white, unsigned int nb_black);
74e2b93b
JB
47
48int** init_pawns(unsigned int pawn_array[board_size][board_size]);
a8b54576
JB
49unsigned int get_box_value(int y, int x, unsigned int pawn_array[board_size][board_size]);
50int** set_pawn(int y, int x, unsigned int type, unsigned int pawn_array[board_size][board_size]);
74e2b93b 51
54f1c58c 52bool is_valid_input(int y, int x, unsigned int pawn_array[board_size][board_size]);
74e2b93b 53bool is_box_type(int y, int x, unsigned int pawn_array[board_size][board_size], unsigned int type);
54f1c58c 54bool is_board_full(unsigned int pawn_array[board_size][board_size]);
74e2b93b
JB
55
56unsigned int count_pawn_type(unsigned int pawn_array[board_size][board_size], unsigned int type);
2e5c1894 57
4ddf6f1a 58#endif /* OTHELLO_H */