Commit e4368db6 authored by Emil's avatar Emil

add nextPos

parent 09d52e27
......@@ -27,8 +27,24 @@ namespace gameengine::utility
BitPos nextPosition(const BitPos& board_pos, const MoveDirection& dir)
{
if (dir.value()== N && board_pos.value() < 55)
return board_pos.value()+8;
switch (dir) {
case MoveDirection::N:
return gameengine::BitPos(board_pos.value()+8);
case MoveDirection::S:
return gameengine::BitPos(board_pos.value()-8);
case MoveDirection::E:
return gameengine::BitPos(board_pos.value()+1);
case MoveDirection::W:
return gameengine::BitPos(board_pos.value()-1);
case MoveDirection::SE:
return gameengine::BitPos(board_pos.value()-7);
case MoveDirection::SW:
return gameengine::BitPos(board_pos.value()-9);
case MoveDirection::NE:
return gameengine::BitPos(board_pos.value()+9);
case MoveDirection::NW:
return gameengine::BitPos(board_pos.value()+7);
}
}
BitPosSet legalMoves(const BitBoard& /*board*/, const PlayerId& /*player_id*/)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment