diff --git a/puissance4_GRB/puissance4.c b/puissance4_GRB/puissance4.c index 7f88800bcb702383ed23bb81c71a656785a82ce2..2b77a4b00e1fc53f9f4d3cd197959da6c3cceb76 100644 --- a/puissance4_GRB/puissance4.c +++ b/puissance4_GRB/puissance4.c @@ -20,7 +20,6 @@ struct cell **Create_grid2D(){ //initialise les positions et les valeurs de base for(int i = 0; i<game.width; i++){ for(int j=0; j<game.height; j++){ - cells[i][j].pressed = false; cells[i][j].symbol = EMPTY; cells[i][j].i_pos = i; cells[i][j].j_pos = j; @@ -68,10 +67,6 @@ int kill_game(){ return EXIT_SUCCESS; } -/*void Show_grid(struct cell** cell){ - //return 0; -}*/ - int put_free_cell(int j_p, symbol_t symbol){ int i=0; @@ -314,7 +309,11 @@ int SmartBot(){ return chfr2; }else{ //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; } } diff --git a/puissance4_GRB/puissance4.h b/puissance4_GRB/puissance4.h index 6ceb1a684f2c0eb9cd91a616b4a9df1977db7d6a..3f1ebe93ca114726ee0fb6fcd54c49bccd19bb0f 100644 --- a/puissance4_GRB/puissance4.h +++ b/puissance4_GRB/puissance4.h @@ -13,7 +13,6 @@ typedef enum{ }symbol_t; struct cell{ - bool pressed; symbol_t symbol; int i_pos; int j_pos;