33struct timespec t_start ;
44int max_time_ms = 100 ;
55
6- static const int piece_value [7 ] = {
7- 0 ,
8- 900 ,
9- 320 ,
10- 330 ,
11- 100 ,
12- 500 ,
13- INFINI ,
14- };
15-
16- int compare_moves_desc (const void * a , const void * b )
17- {
18- return ((ScoredMove * )b )-> score - ((ScoredMove * )a )-> score ;
19- }
20-
21- int get_value_piece (int square , Chessboard * board )
22- {
23- uint64_t piece_pos = create_1bit_board (square );
24- if (board -> pawns & piece_pos )
25- return piece_value [PAWN ];
26- if (board -> queens & piece_pos )
27- return piece_value [QUEEN ];
28- if (board -> knights & piece_pos )
29- return piece_value [KNIGHT ];
30- if (board -> bishops & piece_pos )
31- return piece_value [BISHOP ];
32- if (board -> rooks & piece_pos )
33- return piece_value [ROOK ];
34- if (board -> kings & piece_pos )
35- return piece_value [KING ];
36- return 0 ;
37- }
38-
396typedef struct
407{
418 Move best_move ;
@@ -46,7 +13,7 @@ typedef struct
4613 * Recherche Alpha-Beta récursive
4714 * Retourne une évaluation numérique pour la position courante.
4815 */
49- int alpha_beta (Chessboard * board , int depth , int alpha , int beta , bool maximizingPlayer )
16+ static int alpha_beta (Chessboard * board , int depth , int alpha , int beta , bool maximizingPlayer )
5017{
5118 if (depth == 0 ) // Rajouter une condition sur mat et pat
5219 {
@@ -104,7 +71,7 @@ int alpha_beta(Chessboard *board, int depth, int alpha, int beta, bool maximizin
10471/**
10572 * Recherche le meilleur coup à une profondeur donnée.
10673 */
107- SearchResult search_best_move_alpha_beta (Chessboard * board , int depth )
74+ static SearchResult search_best_move_alpha_beta (Chessboard * board , int depth )
10875{
10976 Move moves [250 ];
11077 int nb_moves = getalllegalmoves (board , moves );
@@ -145,9 +112,3 @@ Move get_best_move(Chessboard board)
145112 SearchResult best_move = search_best_move_alpha_beta (& board , 5 );
146113 return best_move .best_move ;
147114}
148-
149- void initialise_ai (int color_ai )
150- {
151- initialize_tables (color_ai );
152- init_zobrist ();
153- }
0 commit comments