From dedcfde9aa411ac0bd79b975c17f5823b43a92c0 Mon Sep 17 00:00:00 2001 From: Mikael Le <mikael.le@insa-rennes.fr> Date: Tue, 20 Oct 2015 12:18:21 +0200 Subject: [PATCH] mod 2 mika --- src/game/morpion.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game/morpion.cpp b/src/game/morpion.cpp index eba70a6..e45aed1 100644 --- a/src/game/morpion.cpp +++ b/src/game/morpion.cpp @@ -68,7 +68,7 @@ namespace game uint8_t morpion::current_player() const { return state.total_moves & 1 ? CIRCLE : CROSS; // CROSS even, CIRCLE odd - } + } int morpion::value(uint8_t player) const { @@ -99,11 +99,11 @@ namespace game bool morpion::has_won(uint16_t bitboard) { - if(bitboard == ROW1_MASK || bitboard == ROW2_MASK || bitboard == ROW3_MASK) // Check vertical | + if(bitboard == ROW0_MASK || bitboard == ROW1_MASK || bitboard == ROW2_MASK) // Check vertical | return true; - if(bitboard == COL1_MASK || bitboard == COL2_MASK || bitboard == COL3_MASK) // Check horizontal _ + if(bitboard == COL0_MASK || bitboard == COL1_MASK || bitboard == COL2_MASK) // Check horizontal _ return true; - if(bitboard == DIA1_MASK || bitboard == DIA2_MASK) // Chack diagonal \ / + if(bitboard == DIA0_MASK || bitboard == DIA1_MASK) // Chack diagonal \ / return true; return false; } @@ -113,9 +113,11 @@ namespace game //TODO: Implement } - void morpion::play(uint16_t m) - { - //TODO: Implement + void morpion::play(uint16_t m) // not finished + { + uint16_t bitboard = cross_bitboard | circle_bitboard; + if(current_player() == CROSS) + } string morpion::player_to_string(uint8_t player) const -- GitLab