# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#tldr
BINARY_NAME:=othello
SRC_PATH:=src
-# will add -lothello automagically linking flags
-LIBRARY_NAME:=libothello
+LIBRARY_NAME:=lib$(BINARY_NAME)
LIBRARY_PATH:=lib
-LDLIBS:=-lncurses -ltinfo
+LDLIBS:=-l$(BINARY_NAME) -lncurses -ltinfo
BUILD_TYPE:=debug
#BUILD_TYPE:=release
set_pawn(y, x, current_player, pawn_array);
return nb_pawns_reversed;
}
+
+struct shots_list_s build_playable_shots_list(int y, int x, unsigned int current_player, unsigned int pawn_array[board_size][board_size]) {
+
+ for (unsigned int i = 0; i <= board_size; i++) {
+ for (unsigned int j = 0; j <= board_size; j++) {
+ if (is_legal_shot(y, x, current_player, pawn_array)) {
+
+ }
+ }
+ }
+}
+
+void create_shots_list_cell(struct shots_list_s* shots_list_cell) {
+
+}
+
+static void set_shots_list_coordinates(int y, int x, struct shots_list_s* shots_list) {
+
+ if (is_valid_coordinates(y, x)) {
+ shots_list->y = y;
+ shots_list->x = x;
+ }
+}
+
+void set_shots_lists_cell(int y, int x, unsigned int type, struct shots_list_s* shots_list) {
+
+ if (type > 0 && type < 5) {
+ set_shots_list_coordinates(y, x, shots_list);
+ shots_list->type = type;
+ }
+}
char* draw_msg = "Egalite !";
char* exit_msg = "Pressez une touche pour sortir ou \'r\' pour rejouer";
- /* linked list of the history shots */
- //struct shots_history_list_s shots_history;
- //INIT_LIST_HEAD(&shots_history.list);
- /* linked list of black playable shots */
- struct shots_list_s black_playable_shots;
- INIT_LIST_HEAD(&black_playable_shots.list);
- /* linked list of white playable shots */
- struct shots_list_s white_playable_shots;
- INIT_LIST_HEAD(&white_playable_shots.list);
+ /* linked list of playable shots */
+ struct shots_list_s playable_shots;
+ INIT_LIST_HEAD(&playable_shots.list);
unsigned int pawns[board_size][board_size] = {
{0, 0},