Dumb but not dumber IA
This commit is contained in:
parent
033a436be2
commit
87e7ff5829
7 changed files with 145 additions and 34 deletions
|
@ -24,4 +24,9 @@ typedef enum {
|
|||
ALMOST,
|
||||
} e_status;
|
||||
|
||||
typedef enum {
|
||||
HUMAN,
|
||||
RANDOM,
|
||||
CLEVER,
|
||||
} e_tactic;
|
||||
#endif /*COMMON*/
|
||||
|
|
17
include/ia.h
Normal file
17
include/ia.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef IA_H
|
||||
#define IA_H
|
||||
#include "common.h"
|
||||
#include "model.h"
|
||||
/*!
|
||||
* This function modify the move in parameter in order to get a valid move (1) randomly if tactic is 0 or
|
||||
* (2) in a clever way if tactic is 1 in the corresponding utictactoe u.
|
||||
*
|
||||
* \param p_uttt a pointer on a s_utictactoe.
|
||||
* \param p_move a pointer on a s_move to be modified.
|
||||
* \param tactic an e_tactic set to 0 for random strategy and 1 for clever one.
|
||||
*/
|
||||
void best_move(s_utictactoe* p_uttt, s_move* p_move, e_tactic tactic);
|
||||
|
||||
s_tictactoe * clone_ttt( s_tictactoe * p_ttt );
|
||||
e_location get_best_random_position( s_tictactoe * p_uttt, e_player player);
|
||||
#endif
|
|
@ -25,8 +25,9 @@ int elocation_to_coord(e_location l);
|
|||
* \param p_move a pointer on a s_move to be modified.
|
||||
* \param v a pointer on the view to use.
|
||||
*/
|
||||
void set_next_player_move(s_move * p_move, p_view v);
|
||||
void set_next_player_move(s_move * p_move, p_view v, e_tactic tactic);
|
||||
|
||||
void display_winner(p_view v);
|
||||
/*!
|
||||
* This function free all the memory used by a given view which
|
||||
* reference is given.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue