diff --git a/src/game/morpion.cpp b/src/game/morpion.cpp index 82febcc0bab9da96d8e3f3c6168363849d2bdee0..e3445cee3c3e53ba93c90aa34e1ba11dbb41cc1c 100644 --- a/src/game/morpion.cpp +++ b/src/game/morpion.cpp @@ -73,10 +73,10 @@ namespace game int morpion::value(uint8_t player) const { if (player == CROSS) { - return state.first_player_win? 1 : (state.second_player_win? -1 : 0) + return state.first_player_win? 1 : (state.second_player_win? -1 : 0); } else if (player == CIRCLE) { - return state.second_player_win? 1 : (state.first_player_win? -1 : 0) + return state.second_player_win? 1 : (state.first_player_win? -1 : 0); } return 0; } @@ -86,7 +86,7 @@ namespace game return state.total_moves; } - bool morpion::get(uint64_t bitboard, uint8_t col, uint8_t row) const + bool morpion::get(uint16_t bitboard, uint8_t col, uint8_t row) const { return bitboard & (1LL << (3*row)) << col; } @@ -112,16 +112,17 @@ namespace game return false; } + /* void morpion::update_moves(uint16_t move) { //TODO: Implement } + */ - void morpion::play(uint16_t m) // not finished + void morpion::play(uint16_t m) { - uint16_t bitboard = cross_bitboard | circle_bitboard; - if(current_player() == CROSS) - + uint16_t bitboard = state.cross_bitboard | state.circle_bitboard; + return; } @@ -140,7 +141,7 @@ namespace game { uint8_t row = m/3; uint8_t col = m%3; - return "( "std::to_string(row)", "std::to_string(col)" )"; + return "( "+std::to_string(row)+", "+std::to_string(col)+" )"; } @@ -155,8 +156,9 @@ namespace game string morpion::to_string() const { - for (int i = 0 + //for (int i = 0 //TODO PAR ROMAIN + return ""; } void morpion::playout(mt19937& engine, int max_depth) diff --git a/src/game/morpion.hpp b/src/game/morpion.hpp index b18d82664845a268b51d2f183ff2dc77395b1888..327f1b5afcd72f9dd94535a6a2d7797a753f90dc 100644 --- a/src/game/morpion.hpp +++ b/src/game/morpion.hpp @@ -49,7 +49,7 @@ namespace game inline void update_win(); //Check if someone won and update the state inline bool has_won(uint16_t bitboard); //Check if the player whose bitboard was passed as a param has won inline bool get(uint16_t bitboard, uint8_t i, uint8_t j) const; //Get a case of the board - + const uint8_t CROSS = 0; const uint8_t CIRCLE = 1;