#include "coordinates.h"
-void init_coordinates(coordinates_t* coordinates_array) {
+void zero_coordinates(coordinates_t* coordinates_array) {
for (unsigned i = 0; i < MAX_COORDINATES; i++) {
coordinates_array[i] = set_coordinates(0, 0, 0);
}
}
-void reinit_coordinates(coordinates_t* coordinates_array) {
-
- init_coordinates(coordinates_array);
-}
-
coordinates_t set_coordinates(int y, int x, unsigned type) {
coordinates_t new_coordinates;
unsigned type; /* 0 = O, 1 = X */
} coordinates_t;
-void init_coordinates(coordinates_t* coordinates_array);
-void reinit_coordinates(coordinates_t* coordinates_array);
+void zero_coordinates(coordinates_t* coordinates_array);
coordinates_t set_coordinates(int y, int x, unsigned type);
unsigned add_coordinates(coordinates_t new_coordinates, coordinates_t* coordinates_array, unsigned round);
bool chk_win_conditions(coordinates_t* coordinates_array, unsigned round);
curs_set(0);
/* array of the active coordinates in the entered order */
- coordinates_t coordinates_array[MAX_COORDINATES];
- init_coordinates(coordinates_array);
+ coordinates_t coordinates_array[MAX_COORDINATES] = {
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0},
+ {0, 0, 0}
+ };
coordinates_t new_coordinates = {0, 0, 0};
/* center base coordinates for the board */
round = 0;
player = 0;
errno = 0;
- reinit_coordinates(coordinates_array);
+ zero_coordinates(coordinates_array);
winning_condition = false;
loop_exit_condition = false;
clear();