Commits

Shlomi Fish  committed aa9bbc2

Extract the print_sol function.

  • Participants
  • Parent commits 2fa19cb

Comments (0)

Files changed (1)

File kakurasu-solver/kakurasu-solver.py

 import re
 import sys
 
+def print_sol(sol):
+
+    for row in sol:
+        for cell in row:
+            sys.stdout.write ('█' if (cell != 0) else '⨯')
+        sys.stdout.write("\n")
+
+    return
+
 def kakurasu_main(args):
     input_fn = args.pop(1)
 
     sol = solve_file(input_fn)
 
-    for row in sol:
-        for cell in row:
-            sys.stdout.write ('█' if (cell != 0) else '⨯')
-        sys.stdout.write("\n")
+    print_sol(sol)
 
     return 0