TP 13 exo2: Implement the missing bits to do a full game.
[TD_C.git] / TP_13 / exo2 / lib / coordinates.h
CommitLineData
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
27typedef struct coordinates_s {
28 int y;
29 int x;
30 unsigned type; /* 0 = O, 1 = X */
31} coordinates_t;
32
33void init_coordinates(coordinates_t* coordinates_array);
34coordinates_t set_coordinates(int y, int x, unsigned type);
04b0afb5
JB
35unsigned add_coordinates(coordinates_t new_coordinates, coordinates_t* coordinates_array, unsigned round);
36bool chk_win_conditions(coordinates_t* coordinates_array);
5df3071e
JB
37
38#endif /* COORDINATES_H */