Commit | Line | Data |
---|---|---|
5df3071e JB |
1 | /* |
2 | * ===================================================================================== | |
3 | * | |
4 | * Filename: coordinates.h | |
5 | * | |
6 | * Description: Header for data definition and functions to manipulate elements in the grid | |
7 | * | |
8 | * Version: 1.0 | |
9 | * Created: 16/03/2017 19:06:16 | |
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 COORDINATES_H | |
20 | #define COORDINATES_H | |
21 | ||
04b0afb5 JB |
22 | #include <stdbool.h> |
23 | ||
5df3071e JB |
24 | /* we only have nine elements in the grid */ |
25 | #define MAX_COORDINATES 9 | |
26 | ||
27 | typedef struct coordinates_s { | |
28 | int y; | |
29 | int x; | |
30 | unsigned type; /* 0 = O, 1 = X */ | |
31 | } coordinates_t; | |
32 | ||
5df3071e | 33 | coordinates_t set_coordinates(int y, int x, unsigned type); |
bbf5487f | 34 | void zero_coordinates(coordinates_t* coordinates_array); |
04b0afb5 | 35 | unsigned add_coordinates(coordinates_t new_coordinates, coordinates_t* coordinates_array, unsigned round); |
811d4abe | 36 | bool chk_win_conditions(coordinates_t* coordinates_array, unsigned round); |
5df3071e JB |
37 | |
38 | #endif /* COORDINATES_H */ |