tictactoe_solver.cpp
// Checks if the left diagnol on the board is blocked
//
// @param board the tictactoe board
// @param x the column position
// @param y the row position
//
// @return whether the left diagnol on the board is blocked

Checks if the left diagnol on the board is blocked
Checks if the left diagnol on the board is blocked
bool tictactoeai::IsLeftDiagnolBlocked(const tictactoe::TicTacToe &board,
                                       unsigned int x, unsigned int y)
{
  char piece = board.get_board_data()[x][y];
  if ((x == 0 && y == 2) || (x==1 && y==1) || (x==2 && y==0))
  {
    if ((board.get_board_data()[0][2] == ' ' ||
         board.get_board_data()[0][2] == piece) &&
        (board.get_board_data()[1][1] == ' ' ||
         board.get_board_data()[1][1] == piece) &&
        (board.get_board_data()[2][0] == ' ' ||
         board.get_board_data()[2][0] == piece))
      return false;
  }
  return true;
}
bool tictactoeai :: IsLeftDiagnolBlocked ( const tictactoe :: TicTacToe & board , unsigned int x , unsigned int y ) { char piece = board . get_board_data ( ) [ x ] [ y ] ; if ( ( x == 0 && y == 2 ) || ( x == 1 && y == 1 ) || ( x == 2 && y == 0 ) ) { if ( ( board . get_board_data ( ) [ 0 ] [ 2 ] == ' ' || board . get_board_data ( ) [ 0 ] [ 2 ] == piece ) && ( board . get_board_data ( ) [ 1 ] [ 1 ] == ' ' || board . get_board_data ( ) [ 1 ] [ 1 ] == piece ) && ( board . get_board_data ( ) [ 2 ] [ 0 ] == ' ' || board . get_board_data ( ) [ 2 ] [ 0 ] == piece ) ) return false ; } return true ; }
Checks if the left diagnol on the board is blocked
Checks if the left diagnol on the board is blocked
// check if the given position is on the left angle
