Ejemplo n.º 1
0
u8 anyMovesLeft() {
    u8 i, j;
    u8 movesLeft;

    movesLeft = 0;

    if (countZeroes() == 0) {
        for (i = 0; i < 4; i++) {
            for (j = 0; j < 4; j++) {
                getAdjacents(i, j);
                if (((cells[i][j] == 1) && anyOfThisInAdjacents(2)) ||
                        ((cells[i][j] == 2) && anyOfThisInAdjacents(1)) ||
                        ((cells[i][j] > 2) && anyOfThisInAdjacents(cells[i][j]))) {
                    movesLeft = 1;
                    break;
                }
            }
            if (movesLeft)
                break;
        }

    } else
        movesLeft = 1;
    return movesLeft;
}
Ejemplo n.º 2
0
void solveCase(void)
{
    int num;
    scanf("%d",&num);
    max=num;
    int numofzeroes = countZeroes(num);

    if(numofzeroes == 0)
        printf("%d\n",num);
    else{
        //Now minimize the number
       printf( "%d\n",minimize(max));
    }
}