[gnome-sudoku/qqwing] Code cleanup



commit b7d729895d8c31facb1b32093e320b4a4de51916
Author: Parin Porecha <parinporecha gmail com>
Date:   Wed Aug 6 13:58:10 2014 +0200

    Code cleanup

 lib/sudoku-generator.vala |   12 ------------
 src/gnome-sudoku.vala     |   13 +------------
 2 files changed, 1 insertions(+), 24 deletions(-)
---
diff --git a/lib/sudoku-generator.vala b/lib/sudoku-generator.vala
index 10f5778..3558090 100644
--- a/lib/sudoku-generator.vala
+++ b/lib/sudoku-generator.vala
@@ -7,28 +7,16 @@ public class SudokuGenerator : Object
 
     public SudokuBoard generate (DifficultyCategory category)
     {
-        stdout.printf ("Generating a puzzle of difficulty %s ...\n\n", category.to_string ());
-
         var board = new SudokuBoard ();
         int[] puzzle = QQwing.generate_puzzle ((int) category + 1);
-        stdout.printf ("puzzle length = %d\n", puzzle.length);
-
-//        assert (puzzle.length >= board.rows * board.cols);
-
-        stdout.printf ("\n");
-        for (var j = 0; j < 81; j++)
-            stdout.printf ("%d", puzzle[j]);
-        stdout.printf ("\n");
 
         for (var row = 0; row < board.rows; row++)
-        {
             for (var col = 0; col < board.cols; col++)
             {
                 var val = puzzle[(row * board.cols) + col];
                 if (val != 0)
                     board.insert (row, col, val, true);
             }
-        }
         board.difficulty_rating = 0;
 
         return board;
diff --git a/src/gnome-sudoku.vala b/src/gnome-sudoku.vala
index a676b5e..0ff3599 100644
--- a/src/gnome-sudoku.vala
+++ b/src/gnome-sudoku.vala
@@ -169,18 +169,7 @@ public class Sudoku : Gtk.Application
         var gen_board = generator.generate (board.get_difficulty_category ());
         var gen_cells = gen_board.get_cells ();
 
-        for (var i = 0; i < board.rows; i++)
-        {
-            for (var j = 0; j < board.cols; j++)
-            {
-                if (gen_cells[i, j] == 0)
-                    stdout.printf (". ");
-                else
-                    stdout.printf ("%d ", gen_cells[i, j]);
-            }
-            stdout.printf ("\n");
-        }
-
+        gen_board.print ();
         generator.print_stats (gen_board);
 
         var difficulty_category = board.get_difficulty_category ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]