Skip to content
Snippets Groups Projects
Commit 23074505 authored by Le Mikael's avatar Le Mikael
Browse files

mod 2 mika

parent dfc1a35b
No related branches found
No related tags found
No related merge requests found
...@@ -67,7 +67,7 @@ namespace game ...@@ -67,7 +67,7 @@ namespace game
uint8_t morpion::current_player() const uint8_t morpion::current_player() const
{ {
return state.total_moves & 1 ? CIRCLE : CROSS; // CROSS pair, CIRCLE impair return state.total_moves & 1 ? CIRCLE : CROSS; // CROSS even, CIRCLE odd
} }
int morpion::value(uint8_t player) const int morpion::value(uint8_t player) const
...@@ -91,12 +91,20 @@ namespace game ...@@ -91,12 +91,20 @@ namespace game
void morpion::update_win() void morpion::update_win()
{ {
//TODO: Implement if(has_won(state.cross_bitboard))
state.first_player_win = true;
else if(has_won(state.circle_bitboard))
state.second_player_win = true;
} }
bool morpion::has_won(uint64_t bitboard) bool morpion::has_won(uint16_t bitboard)
{ {
//TODO: Implement if(bitboard == ROW1_MASK || bitboard == ROW2_MASK || bitboard == ROW3_MASK) // Check vertical |
return true;
if(bitboard == COL1_MASK || bitboard == COL2_MASK || bitboard == COL3_MASK) // Check horizontal _
return true;
if(bitboard == DIA1_MASK || bitboard == DIA2_MASK) // Chack diagonal \ /
return true;
return false; return false;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment