From effa820fb00f2c8dbb5aac61b01927c61c4c8013 Mon Sep 17 00:00:00 2001 From: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Date: Fri, 10 Jul 2020 21:51:39 -0400 Subject: [PATCH] Revert "clang-tidy fixes for a86583fe96b065b8a74a49a7dc552add9f096061" This reverts commit 31c9032812259c73f24f49771038a24cb63ba747. --- misc/sudoku_solver.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/misc/sudoku_solver.c b/misc/sudoku_solver.c index ff6a405e..9701c8bb 100644 --- a/misc/sudoku_solver.c +++ b/misc/sudoku_solver.c @@ -49,13 +49,9 @@ bool OKrow(const struct sudoku *a, int x, int y, int v) { int offset = x * a->N; for (int j = 0; j < a->N; j++) - { if (a->a[offset + j] == v) - { // if the value is found in the row return false; - } - } return true; } @@ -71,13 +67,9 @@ bool OKrow(const struct sudoku *a, int x, int y, int v) bool OKcol(const struct sudoku *a, int x, int y, int v) { for (int i = 0; i < a->N; i++) - { if (a->a[i * a->N + y] == v) - { // if the value is found in the column return false; - } - } return true; } @@ -100,16 +92,10 @@ bool OKbox(const struct sudoku *a, int x, int y, int v) // printf("Checking box: (%d,%d)\n", bi, bj); for (int i = bi; i < (bi + a->N2); i++) - { for (int j = bj; j < (bj + a->N2); j++) - { if (a->a[i * a->N + j] == v) - { // if the value is found in the box return false; - } - } - } return true; } @@ -126,13 +112,9 @@ bool OK(const struct sudoku *a, int x, int y, int v) { bool result = OKrow(a, x, y, v); if (result) - { result = OKcol(a, x, y, v); - } if (result) - { result = OKbox(a, x, y, v); - } return result; } @@ -145,13 +127,9 @@ void print(const struct sudoku *a) { int i, j; for (i = 0; i < a->N; i++) - { for (j = 0; j < a->N; j++) - { printf("%" SCNu8 "%c", a->a[i * a->N + j], (j == a->N - 1 ? '\n' : ' ')); - } - } } /** @@ -258,12 +236,8 @@ void test() 6, 4, 3, 1, 3, 8, 9, 4, 7, 2, 5, 6, 6, 9, 2, 3, 5, 1, 8, 7, 4, 7, 4, 5, 2, 8, 6, 3, 1, 9}; for (int i = 0; i < a.N; i++) - { for (int j = 0; j < a.N; j++) - { assert(a.a[i * a.N + j] == expected[i * a.N + j]); - } - } printf("Test passed\n"); } @@ -279,22 +253,16 @@ int main() a.N2 = (uint8_t)sqrt(a.N); for (int i = 0; i < a.N; i++) - { for (int j = 0; j < a.N; j++) scanf("%" SCNu8, &(a.a[i * a.N + j])); - } printf("Entered a %udx%ud matrix with block size: %" SCNu8 "\n", a.N, a.N, a.N2); // print(&a); printf("\n\n"); if (solve(&a)) - { printf("Valid solution found!\n"); - } else - { printf("Invalid\n"); - } print(&a); free(a.a);