about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--awk/nqueens.awk6
1 files changed, 3 insertions, 3 deletions
diff --git a/awk/nqueens.awk b/awk/nqueens.awk
index a426537..423e71e 100644
--- a/awk/nqueens.awk
+++ b/awk/nqueens.awk
@@ -1,12 +1,12 @@
 # Check if a position is safe for a queen
 function is_safe(board, row, col, N) {
     for (i = 1; i < row; i++) {
-        # Check column and diagonals
+        # Check if there is a queen in the same column or diagonals as the current position
         if (board[i] == col || board[i] - i == col - row || board[i] + i == col + row) {
-            return 0
+            return 0  # Oh no! Not safe! There is a queen attacking the current position
         }
     }
-    return 1
+    return 1  # Safe! No queens
 }
 
 # Print the board configuration