Skip to content
Snippets Groups Projects
Commit 5dc9fe02 authored by remi.greub's avatar remi.greub
Browse files

amélioration du smartbot en cas random + colonne pleine

parent 005def8f
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,6 @@ struct cell **Create_grid2D(){ ...@@ -20,7 +20,6 @@ struct cell **Create_grid2D(){
//initialise les positions et les valeurs de base //initialise les positions et les valeurs de base
for(int i = 0; i<game.width; i++){ for(int i = 0; i<game.width; i++){
for(int j=0; j<game.height; j++){ for(int j=0; j<game.height; j++){
cells[i][j].pressed = false;
cells[i][j].symbol = EMPTY; cells[i][j].symbol = EMPTY;
cells[i][j].i_pos = i; cells[i][j].i_pos = i;
cells[i][j].j_pos = j; cells[i][j].j_pos = j;
...@@ -68,10 +67,6 @@ int kill_game(){ ...@@ -68,10 +67,6 @@ int kill_game(){
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
/*void Show_grid(struct cell** cell){
//return 0;
}*/
int put_free_cell(int j_p, symbol_t symbol){ int put_free_cell(int j_p, symbol_t symbol){
int i=0; int i=0;
...@@ -314,7 +309,11 @@ int SmartBot(){ ...@@ -314,7 +309,11 @@ int SmartBot(){
return chfr2; return chfr2;
}else{ }else{
//3e cas : joue un coup au hasard //3e cas : joue un coup au hasard
return rand()%game.width; int randomchfr=0;
do{
randomchfr = rand()%game.width;
}while((is_cell_free(randomchfr, 0, game.players[game.curr_player].symbol))<0);
return randomchfr;
} }
} }
......
...@@ -13,7 +13,6 @@ typedef enum{ ...@@ -13,7 +13,6 @@ typedef enum{
}symbol_t; }symbol_t;
struct cell{ struct cell{
bool pressed;
symbol_t symbol; symbol_t symbol;
int i_pos; int i_pos;
int j_pos; int j_pos;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment