Commit 845c0180 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Also indent the headers

parent 6f109ceb
......@@ -23,7 +23,7 @@
extern "C"
{
#endif
struct TarotAi;
typedef struct TarotAi TarotAi;
......@@ -47,7 +47,7 @@ extern "C"
/**
* tarot_ai_dup:
*/
TarotAi *tarot_ai_dup (const TarotAi *ai);
TarotAi *tarot_ai_dup (const TarotAi * ai);
/**
* tarot_ai_alloc_perceptron: (constructor)
......@@ -60,19 +60,22 @@ extern "C"
*/
TarotAi *tarot_ai_alloc_random (size_t seed_size, const void *seed);
void tarot_ai_free (TarotAi *ai);
void tarot_ai_free (TarotAi * ai);
/**
* tarot_ai_eval:
* @candidates: (transfer none) (array length=n_candidates):
* @scores: (array length=max):
*/
void tarot_ai_eval (TarotAi *ai, const TarotGame *base, size_t n_candidates, TarotGameEvent **candidates, size_t start, size_t max, double *scores);
void tarot_ai_eval (TarotAi * ai, const TarotGame * base,
size_t n_candidates, TarotGameEvent ** candidates,
size_t start, size_t max, double *scores);
/**
* tarot_ai_learn:
*/
void tarot_ai_learn (TarotAi *ai, const TarotGame *base, const TarotGameEvent *event, double final_score);
void tarot_ai_learn (TarotAi * ai, const TarotGame * base,
const TarotGameEvent * event, double final_score);
/**
* tarot_ai_strongest_player:
......@@ -80,21 +83,26 @@ extern "C"
* @confidence: (out):
* @call: (out):
*/
TarotPlayer tarot_ai_strongest_player (TarotAi *ai, size_t n_players, int with_call, size_t n_cards, const TarotPlayer *owners, double *confidence, TarotCard *call);
TarotPlayer tarot_ai_strongest_player (TarotAi * ai, size_t n_players,
int with_call, size_t n_cards,
const TarotPlayer * owners,
double *confidence,
TarotCard * call);
/**
* tarot_ai_best:
* @score: (out):
*/
const TarotGameEvent *tarot_ai_best (TarotAi *ai, const TarotGame *state, double *score);
const TarotGameEvent *tarot_ai_best (TarotAi * ai, const TarotGame * state,
double *score);
/**
* tarot_ai_validate:
*/
double tarot_ai_validate (TarotAi *ai, const TarotGame *validation_game);
double tarot_ai_validate (TarotAi * ai, const TarotGame * validation_game);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* not H_TAROT_AI_INCLUDED */
#endif /* not H_TAROT_AI_INCLUDED */
......@@ -31,21 +31,24 @@ extern "C"
* tarot_cnn_predict:
* @score_out: (array length=max_score):
*/
size_t tarot_cnn_predict (const TarotGame *game, size_t max_score, double *score_out);
size_t tarot_cnn_predict (const TarotGame * game, size_t max_score,
double *score_out);
/**
* tarot_cnn_predict_alloc:
* @score: (out) (array length=n_score):
* @n_score: (out):
*/
void tarot_cnn_predict_alloc (const TarotGame *game, double **score, size_t *n_score);
void tarot_cnn_predict_alloc (const TarotGame * game, double **score,
size_t *n_score);
/**
* tarot_cnn_predictor_construct:
* @mem_out: (array length=max_mem):
* @alignment: (out):
*/
size_t tarot_cnn_predictor_construct (size_t max_mem, char *mem_out, size_t *alignment);
size_t tarot_cnn_predictor_construct (size_t max_mem, char *mem_out,
size_t *alignment);
/**
* tarot_cnn_predictor_alloc:
......@@ -54,6 +57,6 @@ extern "C"
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */
#endif /* not H_TAROT_CNN_INCLUDED */
#endif /* not H_TAROT_CNN_INCLUDED */
......@@ -59,7 +59,7 @@ extern "C"
* tarot_mcts_default_iterations:
*/
size_t tarot_mcts_default_iterations ();
struct TarotMctsNode;
#define TAROT_MCTS_NULL NULL
......@@ -70,14 +70,18 @@ extern "C"
* @n_simulations: (out):
* @sum_scores: (out):
*/
const struct TarotGameEvent *tarot_mcts_get (const struct TarotMctsNode * node,
size_t *n_simulations,
int *sum_scores);
const struct TarotMctsNode *tarot_mcts_parent (const struct TarotMctsNode * node);
const struct TarotMctsNode *tarot_mcts_first_child (const struct TarotMctsNode * node);
const struct TarotMctsNode *tarot_mcts_next_sibling (const struct TarotMctsNode * node);
const struct TarotMctsNode *tarot_mcts_previous_sibling
(const struct TarotMctsNode * node);
const struct TarotGameEvent *tarot_mcts_get (const struct TarotMctsNode
*node, size_t *n_simulations,
int *sum_scores);
const struct TarotMctsNode *tarot_mcts_parent (const struct TarotMctsNode
*node);
const struct TarotMctsNode *tarot_mcts_first_child (const struct
TarotMctsNode *node);
const struct TarotMctsNode *tarot_mcts_next_sibling (const struct
TarotMctsNode *node);
const struct TarotMctsNode *tarot_mcts_previous_sibling (const struct
TarotMctsNode
*node);
/**
* tarot_mcts_save_to_xml:
......@@ -85,7 +89,7 @@ extern "C"
*/
size_t tarot_mcts_save_to_xml (const TarotMcts * mcts, size_t start,
size_t max, char *dest_out);
char *tarot_mcts_save_to_xml_alloc (const TarotMcts *mcts);
char *tarot_mcts_save_to_xml_alloc (const TarotMcts * mcts);
#ifdef __cplusplus
}
......
......@@ -86,10 +86,12 @@ extern "C"
/**
* tarot_counter_and_game_impute_likely
*/
TarotImputationError tarot_counter_and_game_impute_likely (TarotCounter *counter,
TarotGame *game,
size_t seed_size,
const void *seed);
TarotImputationError tarot_counter_and_game_impute_likely (TarotCounter *
counter,
TarotGame * game,
size_t seed_size,
const void
*seed);
#ifdef __cplusplus
}
......
......@@ -316,7 +316,8 @@ extern "C"
TarotGameEventError tarot_game_event_get_deal_all (const TarotGameEvent *
event, size_t *n_owners,
size_t start, size_t max,
TarotPlayer * owners_out);
TarotPlayer *
owners_out);
/**
* tarot_game_event_get_deal_all_alloc:
......
......@@ -46,7 +46,10 @@ extern "C"
* @encoded: (type boolean):
* @dest_out: (array length=max):
*/
size_t tarot_features_arff_data (const struct TarotGame *base, const struct TarotGameEvent *added, int score, int encoded, size_t max, char *dest_out);
size_t tarot_features_arff_data (const struct TarotGame *base,
const struct TarotGameEvent *added,
int score, int encoded, size_t max,
char *dest_out);
/**
* tarot_features_arff_data_alloc:
......@@ -55,7 +58,9 @@ extern "C"
* @encoded: (type boolean):
* @returns: (transfer full):
*/
char *tarot_features_arff_data_alloc (const struct TarotGame *base, const struct TarotGameEvent *added, int score, int encoded);
char *tarot_features_arff_data_alloc (const struct TarotGame *base,
const struct TarotGameEvent *added,
int score, int encoded);
/* General-purpose features */
......@@ -65,7 +70,8 @@ extern "C"
* @n_players: (out):
* @with_call: (type boolean) (out):
*/
void tarot_features_variant (const struct TarotGame *game, size_t *n_players, int *with_call);
void tarot_features_variant (const struct TarotGame *game,
size_t *n_players, int *with_call);
/**
* tarot_features_position:
......@@ -74,14 +80,16 @@ extern "C"
* @position: (out): the number of players that play before me (for
* bids, decls, or for the current trick)
*/
void tarot_features_position (const struct TarotGame *game, size_t *i_trick, size_t *position);
void tarot_features_position (const struct TarotGame *game, size_t *i_trick,
size_t *position);
/**
* tarot_features_partner_known:
* @game: (type TarotGame):
* @known: (out) (type boolean):
*/
void tarot_features_partner_known (const struct TarotGame *game, int *known);
void tarot_features_partner_known (const struct TarotGame *game,
int *known);
/* Features specific to bidding */
......@@ -90,7 +98,8 @@ extern "C"
* @game: (type TarotGame):
* @minimum: (out):
*/
void tarot_features_bid_minimum (const struct TarotGame *game, TarotBid *minimum);
void tarot_features_bid_minimum (const struct TarotGame *game,
TarotBid * minimum);
/**
* tarot_features_count_faces:
......@@ -102,11 +111,10 @@ extern "C"
* @n_knights: (out):
*/
void tarot_features_count_faces (const struct TarotGame *game,
size_t *n_kings,
size_t *n_marriages,
size_t *n_extended_marriages,
size_t *n_queens,
size_t *n_knights);
size_t *n_kings,
size_t *n_marriages,
size_t *n_extended_marriages,
size_t *n_queens, size_t *n_knights);
/**
* tarot_features_count_minor:
......@@ -117,11 +125,11 @@ extern "C"
* @n_longest: (out):
*/
void tarot_features_count_minor (const struct TarotGame *game,
size_t *n_shortest,
size_t *n_second_shortest,
size_t *n_second_longest,
size_t *n_longest);
size_t *n_shortest,
size_t *n_second_shortest,
size_t *n_second_longest,
size_t *n_longest);
/**
* tarot_features_count_oudlers:
* @game: (type TarotGame):
......@@ -130,9 +138,8 @@ extern "C"
* @has_twentyone: (out) (type boolean):
*/
void tarot_features_count_oudlers (const struct TarotGame *game,
int *has_petit,
int *has_excuse,
int *has_twentyone);
int *has_petit,
int *has_excuse, int *has_twentyone);
/**
* tarot_features_count_trumps:
......@@ -145,12 +152,12 @@ extern "C"
* @median_trumps: (out):
*/
void tarot_features_count_trumps (const struct TarotGame *game,
size_t *n_trumps,
TarotNumber *max_trump,
TarotNumber *min_trump,
TarotNumber *q1_trumps,
TarotNumber *q3_trumps,
TarotNumber *median_trumps);
size_t *n_trumps,
TarotNumber * max_trump,
TarotNumber * min_trump,
TarotNumber * q1_trumps,
TarotNumber * q3_trumps,
TarotNumber * median_trumps);
/**
* tarot_strategy_bid:
......@@ -159,8 +166,8 @@ extern "C"
* @bid: (out):
*/
void tarot_strategy_bid (const struct TarotGame *game,
const struct TarotGameEvent *event,
TarotBid *bid);
const struct TarotGameEvent *event,
TarotBid * bid);
/**
* tarot_strategy_outbid:
......@@ -169,8 +176,8 @@ extern "C"
* @outbid: (out):
*/
void tarot_strategy_outbid (const struct TarotGame *game,
const struct TarotGameEvent *event,
int *outbid);
const struct TarotGameEvent *event,
int *outbid);
/**
* tarot_strategy_call_by_length:
......@@ -182,11 +189,10 @@ extern "C"
* @longest: (out) (type boolean):
*/
void tarot_strategy_call_by_length (const struct TarotGame *game,
const struct TarotGameEvent *event,
int *shortest,
int *second_shortest,
int *second_longest,
int *longest);
const struct TarotGameEvent *event,
int *shortest,
int *second_shortest,
int *second_longest, int *longest);
/**
* tarot_strategy_call_myself:
......@@ -195,8 +201,8 @@ extern "C"
* @myself: (out) (type boolean):
*/
void tarot_strategy_call_myself (const struct TarotGame *game,
const struct TarotGameEvent *event,
int *myself);
const struct TarotGameEvent *event,
int *myself);
/**
* tarot_strategy_call_marriage:
......@@ -205,8 +211,8 @@ extern "C"
* @will_own_marriage: (out) (type boolean):
*/
void tarot_strategy_call_marriage (const struct TarotGame *game,
const struct TarotGameEvent *event,
int *will_own_marriage);
const struct TarotGameEvent *event,
int *will_own_marriage);
/**
* tarot_strategy_discard_save:
......@@ -217,10 +223,10 @@ extern "C"
* @n_jacks_saved: (out):
*/
void tarot_strategy_discard_save (const struct TarotGame *game,
const struct TarotGameEvent *event,
size_t *n_queens_saved,
size_t *n_knights_saved,
size_t *n_jacks_saved);
const struct TarotGameEvent *event,
size_t *n_queens_saved,
size_t *n_knights_saved,
size_t *n_jacks_saved);
/**
* tarot_strategy_discard_junk:
......@@ -229,8 +235,8 @@ extern "C"
* @n_lesser_cards_left_behind: (out):
*/
void tarot_strategy_discard_junk (const struct TarotGame *game,
const struct TarotGameEvent *event,
size_t *n_lesser_cards_left_behind);
const struct TarotGameEvent *event,
size_t *n_lesser_cards_left_behind);
/**
* tarot_strategy_discard_by_length:
......@@ -242,11 +248,11 @@ extern "C"
* @from_longest: (out):
*/
void tarot_strategy_discard_by_length (const struct TarotGame *game,
const struct TarotGameEvent *event,
size_t *from_shortest,
size_t *from_second_shortest,
size_t *from_second_longest,
size_t *from_longest);
const struct TarotGameEvent *event,
size_t *from_shortest,
size_t *from_second_shortest,
size_t *from_second_longest,
size_t *from_longest);
/**
* tarot_features_team:
......@@ -255,8 +261,7 @@ extern "C"
* @defence: (out) (type boolean): whether we may be a defendent
*/
void tarot_features_team (const struct TarotGame *game,
int *attack,
int *defence);
int *attack, int *defence);
/**
* tarot_features_trick_players:
......@@ -265,8 +270,8 @@ extern "C"
* @n_allies_after_last_opponent: (out):
*/
void tarot_features_trick_players (const struct TarotGame *game,
size_t *n_already_played,
size_t *n_allies_after_last_opponent);
size_t *n_already_played,
size_t *n_allies_after_last_opponent);
/**
* tarot_features_minor_suit:
......@@ -285,12 +290,12 @@ extern "C"
* @n_remaining_points: (out):
*/
void tarot_features_minor_suit (const struct TarotGame *game,
int *called_suit,
size_t *n_times_lead,
size_t *n_remaining_cards,
size_t *n_remaining_points,
int *ally_may_be_master,
int *ennemy_may_be_master);
int *called_suit,
size_t *n_times_lead,
size_t *n_remaining_cards,
size_t *n_remaining_points,
int *ally_may_be_master,
int *ennemy_may_be_master);
/**
* tarot_features_trump:
......@@ -300,9 +305,9 @@ extern "C"
* @ennemy_may_be_master: (out) (type boolean):
*/
void tarot_features_trump (const struct TarotGame *game,
size_t *n_remaining,
int *ally_may_be_master,
int *ennemy_may_be_master);
size_t *n_remaining,
int *ally_may_be_master,
int *ennemy_may_be_master);
/**
* tarot_features_points:
......@@ -311,8 +316,7 @@ extern "C"
* @n_oudlers: (out):
*/
void tarot_features_points (const struct TarotGame *game,
size_t *n_halfpoints,
size_t *n_oudlers);
size_t *n_halfpoints, size_t *n_oudlers);
/**
* tarot_strategy_lead:
......@@ -324,11 +328,10 @@ extern "C"
* @trumps: (out) (type boolean):
*/
void tarot_strategy_lead (const struct TarotGame *game,
const struct TarotGameEvent *card,
int *called_suit,
size_t *suit_length,
size_t *n_times_lead,
int *trumps);
const struct TarotGameEvent *card,
int *called_suit,
size_t *suit_length,
size_t *n_times_lead, int *trumps);
/**
* tarot_strategy_purity:
......@@ -340,11 +343,10 @@ extern "C"
* @n_greater_kept: (out):
*/
void tarot_strategy_purity (const struct TarotGame *game,
const struct TarotGameEvent *event,
size_t *n_smaller_kept,
size_t *n_greater_nonface_kept,
size_t *n_points_kept,
size_t *n_greater_kept);
const struct TarotGameEvent *event,
size_t *n_smaller_kept,
size_t *n_greater_nonface_kept,
size_t *n_points_kept, size_t *n_greater_kept);
/**
* tarot_strategy_excuse:
......@@ -353,8 +355,7 @@ extern "C"
* @excuse: (out) (type boolean):
*/
void tarot_strategy_excuse (const struct TarotGame *game,
const struct TarotGameEvent *card,
int *excuse);
const struct TarotGameEvent *card, int *excuse);
/**
* tarot_strategy_trump_master:
......@@ -364,9 +365,9 @@ extern "C"
* @obvious_master: (out) (type boolean):
*/
void tarot_strategy_trump_master (const struct TarotGame *game,
const struct TarotGameEvent *card,
int *actually_master,
int *obvious_master);
const struct TarotGameEvent *card,
int *actually_master,
int *obvious_master);
/**
* tarot_strategy_play_points:
......@@ -376,9 +377,8 @@ extern "C"
* @oudler: (out) (type bool):
*/
void tarot_strategy_play_points (const struct TarotGame *game,
const struct TarotGameEvent *card,
size_t *n_halfpoints,
int *oudler);
const struct TarotGameEvent *card,
size_t *n_halfpoints, int *oudler);
/**
* tarot_features_strongest_player:
......@@ -388,20 +388,20 @@ extern "C"
* @call: (out):
*/
TarotPlayer tarot_features_strongest_player (size_t n_players,
int with_call,
size_t n_cards,
const TarotPlayer *owners,
double *confidence,
TarotCard *call);
int with_call,
size_t n_cards,
const TarotPlayer * owners,
double *confidence,
TarotCard * call);
/**
* tarot_features_errors:
*/
double tarot_features_errors (const TarotGame *game);
double tarot_features_errors (const TarotGame * game);
struct TarotPredictor;
typedef struct TarotPredictor TarotPredictor;
struct TarotGameEvent;
struct TarotGame;
......@@ -411,24 +411,27 @@ extern "C"
* @mem_out: (array length=max_mem):
* @alignment: (out):
*/
size_t tarot_predictor_construct (size_t max_mem, char *mem_out, size_t *alignment);
size_t tarot_predictor_construct (size_t max_mem, char *mem_out,
size_t *alignment);
void tarot_predictor_copy (TarotPredictor *predictor, const TarotPredictor *source);
void tarot_predictor_copy (TarotPredictor * predictor,
const TarotPredictor * source);
/**
* tarot_predictor_alloc: (constructor)
*/
TarotPredictor *tarot_predictor_alloc (void);
TarotPredictor *tarot_predictor_dup (const TarotPredictor *predictor);
TarotPredictor *tarot_predictor_dup (const TarotPredictor * predictor);
void tarot_predictor_free (TarotPredictor *predictor);
void tarot_predictor_free (TarotPredictor * predictor);
/**
* tarot_predictor_set_game:
* @game: (type TarotGame):
*/
void tarot_predictor_set_game (TarotPredictor *predictor, const struct TarotGame *game);
void tarot_predictor_set_game (TarotPredictor * predictor,
const struct TarotGame *game);
/**
......@@ -436,31 +439,37 @@ extern "C"
* @score: (out):
* @returns: (nullable) (type Tarot.GameEvent) (transfer none):
*/
const struct TarotGameEvent *tarot_predictor_best (const TarotPredictor *predictor, double *score);
const struct TarotGameEvent *tarot_predictor_best (const TarotPredictor *
predictor,
double *score);
/**
* tarot_predictor_eval:
* @score_out: (array length=max):
* @candidates: (array length=n_candidates) (type TarotGameEvent*) (transfer none):
*/
size_t tarot_predictor_eval (const TarotPredictor *predictor, size_t n_candidates, struct TarotGameEvent **candidates,
size_t start, size_t max, double *score_out);
size_t tarot_predictor_eval (const TarotPredictor * predictor,
size_t n_candidates,
struct TarotGameEvent **candidates,
size_t start, size_t max, double *score_out);
/**
* tarot_features_cnn_add:
* @data_out: (array length=max):
*/
size_t tarot_features_cnn_add (const TarotGame *game, size_t max, double *data_out);
size_t tarot_features_cnn_add (const TarotGame * game, size_t max,
double *data_out);
/**
* tarot_features_cnn_alloc:
* @data: (out) (transfer full) (array length=n):