X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=lib%2Fothello.h;h=02a711774d3d8b188b71d71a833b69cd60b80b24;hb=3de18b0799930ec82892a0ce65895716e1e8acbc;hp=62fb04a1a8aac5a2fe37ccc7fb00d3ae36495813;hpb=54f1c58cef6764fdd611eedc267e7491e777c09b;p=Project_algorithmic_C.git diff --git a/lib/othello.h b/lib/othello.h index 62fb04a..02a7117 100644 --- a/lib/othello.h +++ b/lib/othello.h @@ -19,24 +19,36 @@ #ifndef OTHELLO_H #define OTHELLO_H +#include + #include "constants.h" #include "list.h" -struct shots_list { +/* linked list of can play shots */ +struct shots_list_s { struct list_head list; - unsigned int*** pawn_array_member; + unsigned int y; + unsigned int x; + 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(unsigned int y, unsigned int x, unsigned int pawn_array[board_size][board_size]); +void set_pawn(unsigned int y, unsigned 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_box_type(unsigned int y, unsigned 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 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]); -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); + +bool is_legal_shot(unsigned int y, unsigned int x, unsigned int current_player, unsigned int pawn_array[board_size][board_size]); +unsigned int valid_shot(unsigned int y, unsigned 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 */