( i + j ) % 2 == 1 cells should be with the character check and the rest should be with the other character
if ( ( ( i + j ) & 1 ) && a [ i ] [ j ] != check ) { return false ; } if ( ! ( ( i + j ) & 1 ) && a [ i ] [ j ] == check ) { return false ; } } } } return true ; }