X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Fothello.h;h=7146617a7a4136d3e2684cc0b6ece662597beea4;hb=9240af1ae3159c7ba2f1ff1152089efd7fa5e38e;hp=a591405db2563216aba4452a265b9d895fdc9801;hpb=45ce2fe369cead248855111baa5fe0c0495acf69;p=Project_algorithmic_C.git diff --git a/lib/othello.h b/lib/othello.h index a591405..7146617 100644 --- a/lib/othello.h +++ b/lib/othello.h @@ -19,40 +19,35 @@ #ifndef OTHELLO_H #define OTHELLO_H +#include + #include "constants.h" #include "list.h" -/* TODO: must be used to replace the explicit pawns 2D array */ -struct pawns_s { - unsigned int pawns[board_size][board_size]; -}; - -/* linked list of played shots */ -struct shots_history_list_s { - struct list_head list; - unsigned int*** pawn_array_member; /* pointer to a cell of the pawns 2D array */ - /* struct* pawns_s pawn */ -}; - /* linked list of can play shots */ -struct shots_exploration_s { +struct shots_list_s { struct list_head list; int y; int x; - unsigned int type; + unsigned int type; /* can be white or black or hint allowed or hint_fordidden */ }; unsigned int current_player(unsigned int round_count); unsigned int eval_winner(unsigned int nb_white, unsigned int nb_black); -int** init_pawns(unsigned int pawn_array[board_size][board_size]); +void zero_pawns(unsigned int pawn_array[board_size][board_size]); +void init_pawns(unsigned int pawn_array[board_size][board_size]); unsigned int get_box_value(int y, int x, unsigned int pawn_array[board_size][board_size]); -int** set_pawn(int y, int x, unsigned int type, unsigned int pawn_array[board_size][board_size]); +void set_pawn(int y, int x, unsigned int type, unsigned int pawn_array[board_size][board_size]); -bool is_valid_input(int y, int x, unsigned int pawn_array[board_size][board_size]); bool is_box_type(int y, int x, unsigned int pawn_array[board_size][board_size], unsigned int type); bool is_board_full(unsigned int pawn_array[board_size][board_size]); -unsigned int count_pawn_type(unsigned int pawn_array[board_size][board_size], unsigned int type); +unsigned int count_pawns_type(unsigned int pawn_array[board_size][board_size], unsigned int type); + +unsigned int valid_shot(int y, int x, unsigned int current_player, unsigned int pawn_array[board_size][board_size]); + +void build_playable_shots_list(unsigned int current_player, struct shots_list_s* shots_list, unsigned int pawn_array[board_size][board_size]); +void free_shots_list(struct shots_list_s* shots_list); #endif /* OTHELLO_H */