include/algos.h
Functions
Name | |
---|---|
play_t * | initialisation(game_t * game, hash_t ** h)Itinialises the root of the tree with the two tiles available. |
play_t * | selection(play_t * play, float c, int n)Selects the play to play. |
play_t * | get_random_tile(linked_plays_t * lp)Returns a random tile from a play list. |
int | simulation(play_t * play, hash_t ** h, game_t * game, bool is_bot, bool is_last_node)Simulates the plays and updates their scores. |
play_t * | ucb(play_t * play, float c, int n) |
play_t * | mcts(game_t * game)Applies the MCTS algorithm for a fixed time. |
Functions Documentation
function initialisation
play_t * initialisation(
game_t * game,
hash_t ** h
)
Itinialises the root of the tree with the two tiles available.
function selection
play_t * selection(
play_t * play,
float c,
int n
)
Selects the play to play.
function get_random_tile
play_t * get_random_tile(
linked_plays_t * lp
)
Returns a random tile from a play list.
function simulation
int simulation(
play_t * play,
hash_t ** h,
game_t * game,
bool is_bot,
bool is_last_node
)
Simulates the plays and updates their scores.
function ucb
play_t * ucb(
play_t * play,
float c,
int n
)
function mcts
play_t * mcts(
game_t * game
)
Applies the MCTS algorithm for a fixed time.
Source code
/* name : algos.h
* authors : eloi petit, matheo thomas, domitille vale
* date : 23-06-24
*/
#ifndef algos_h
#define algos_h
#include "init.h"
#include "utilities.h"
#include "hash_map.h"
/* Struct definitions */
/* Functions definitions */
play_t *initialisation(game_t *game, hash_t **h);
play_t *selection(play_t *play, float c, int n);
play_t *get_random_tile(linked_plays_t *lp);
int simulation(play_t *play, hash_t **h, game_t *game, bool is_bot, bool is_last_node);
play_t *ucb(play_t *play, float c, int n);
play_t *mcts(game_t *game);
#endif
Updated on 2024-06-28 at 08:11:56 +0200