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

mod 2 mika

parent 23074505
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,7 @@ namespace game ...@@ -68,7 +68,7 @@ namespace game
uint8_t morpion::current_player() const uint8_t morpion::current_player() const
{ {
return state.total_moves & 1 ? CIRCLE : CROSS; // CROSS even, CIRCLE odd 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
{ {
...@@ -99,11 +99,11 @@ namespace game ...@@ -99,11 +99,11 @@ namespace game
bool morpion::has_won(uint16_t bitboard) 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; 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; return true;
if(bitboard == DIA1_MASK || bitboard == DIA2_MASK) // Chack diagonal \ / if(bitboard == DIA0_MASK || bitboard == DIA1_MASK) // Chack diagonal \ /
return true; return true;
return false; return false;
} }
...@@ -113,9 +113,11 @@ namespace game ...@@ -113,9 +113,11 @@ namespace game
//TODO: Implement //TODO: Implement
} }
void morpion::play(uint16_t m) void morpion::play(uint16_t m) // not finished
{ {
//TODO: Implement uint16_t bitboard = cross_bitboard | circle_bitboard;
if(current_player() == CROSS)
} }
string morpion::player_to_string(uint8_t player) const string morpion::player_to_string(uint8_t player) const
......
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