| 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 | |
| 22 | #include <stdbool.h> |
| 23 | |
| 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 | |
| 33 | void init_coordinates(coordinates_t* coordinates_array); |
| 34 | coordinates_t set_coordinates(int y, int x, unsigned type); |
| 35 | unsigned add_coordinates(coordinates_t new_coordinates, coordinates_t* coordinates_array, unsigned round); |
| 36 | bool chk_win_conditions(coordinates_t* coordinates_array, unsigned round); |
| 37 | |
| 38 | #endif /* COORDINATES_H */ |