src/sudoku.c
static l_int32
sudokuCompareState(L_SUDOKU  *sud1,
                   L_SUDOKU  *sud2,
                   l_int32    quads,
                   l_int32   *psame)
{
l_int32   i, same;
l_int32  *array;

    PROCNAME("sudokuCompareState");

    if (!psame)
        return ERROR_INT("&same not defined", procName, 1);
    *psame = 0;
    if (!sud1)
        return ERROR_INT("sud1 not defined", procName, 1);
    if (!sud2)
        return ERROR_INT("sud1 not defined", procName, 1);
    if (quads < 1 || quads > 3)
        return ERROR_INT("valid quads in {1,2,3}", procName, 1);

    same = TRUE;
    if ((array = sudokuRotateArray(sud1->state, quads)) == NULL)
        return ERROR_INT("array not made", procName, 1);
    for (i = 0; i < 81; i++) {
        if (array[i] != sud2->state[i]) {
            same = FALSE;
            break;
        }
    }
    *psame = same;
    FREE(array);
    return 0;
}
/*!
 *  sudokuCompareState()
 *
 *      Input:  sud1, sud2
 *              quads (rotation of sud2 input with respect to sud1,
 *                    in units of 90 degrees cw)
 *              &same (<return> 1 if all 4 results are identical; 0 otherwise)
 *      Return: 0 if OK, 1 on error
 *
 *  Notes:
 *      (1) The input to sud2 has been rotated by @quads relative to the
 *          input to sud1.  Therefore, we must rotate the solution to
 *          sud1 by the same amount before comparing it to the
 *          solution to sud2.
 */
sudokuCompareState()
Input:  sud1, sud2
quads (rotation of sud2 input with respect to sud1,
in units of 90 degrees cw)
&same ( 1 if all 4 results are identical; 0 otherwise)
Return: 0 if OK, 1 on error

(1) The input to sud2 has been rotated by @quads relative to the
input to sud1.  Therefore, we must rotate the solution to
sud1 by the same amount before comparing it to the
solution to sud2.
sudokuCompareState () Input : sud1 sud2 quads ( rotation of sud2 input with respect to sud1 in units of 90 degrees cw ) &same ( 1 if all 4 results are identical ; 0 otherwise ) Return : 0 if OK 1 on error ( 1 ) The input to sud2 has been rotated by @quads relative to the input to sud1 . Therefore we must rotate the solution to sud1 by the same amount before comparing it to the solution to sud2 .
static l_int32
sudokuCompareState(L_SUDOKU  *sud1,
                   L_SUDOKU  *sud2,
                   l_int32    quads,
                   l_int32   *psame)
{
l_int32   i, same;
l_int32  *array;
    PROCNAME("sudokuCompareState");
    if (!psame)
        return ERROR_INT("&same not defined", procName, 1);
    *psame = 0;
    if (!sud1)
        return ERROR_INT("sud1 not defined", procName, 1);
    if (!sud2)
        return ERROR_INT("sud1 not defined", procName, 1);
    if (quads < 1 || quads > 3)
        return ERROR_INT("valid quads in {1,2,3}", procName, 1);
    same = TRUE;
    if ((array = sudokuRotateArray(sud1->state, quads)) == NULL)
        return ERROR_INT("array not made", procName, 1);
    for (i = 0; i < 81; i++) {
        if (array[i] != sud2->state[i]) {
            same = FALSE;
            break;
        }
    }
    *psame = same;
    FREE(array);
    return 0;
}
static l_int32 sudokuCompareState ( L_SUDOKU * sud1 , L_SUDOKU * sud2 , l_int32 quads , l_int32 * psame ) { l_int32 i , same ; l_int32 * array ; PROCNAME ( " " ) ; if ( ! psame ) return ERROR_INT ( " " , procName , 1 ) ; * psame = 0 ; if ( ! sud1 ) return ERROR_INT ( " " , procName , 1 ) ; if ( ! sud2 ) return ERROR_INT ( " " , procName , 1 ) ; if ( quads < 1 || quads > 3 ) return ERROR_INT ( " " , procName , 1 ) ; same = TRUE ; if ( ( array = sudokuRotateArray ( sud1 -> state , quads ) ) == NULL ) return ERROR_INT ( " " , procName , 1 ) ; for ( i = 0 ; i < 81 ; i ++ ) { if ( array [ i ] != sud2 -> state [ i ] ) { same = FALSE ; break ; } } * psame = same ; FREE ( array ) ; return 0 ; }
sudokuCompareState()
      Input:  sud1, sud2
              quads (rotation of sud2 input with respect to sud1,
                    in units of 90 degrees cw)
              &same (<return> 1 if all 4 results are identical; 0 otherwise)
      Return: 0 if OK, 1 on error
sudokuCompareState () Input : sud1 sud2 quads ( rotation of sud2 input with respect to sud1 in units of 90 degrees cw ) &same ( <return > 1 if all 4 results are identical ; 0 otherwise ) Return : 0 if OK 1 on error