From 7e172362922db6f528f939049a087479156cabaf Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Thu, 23 Jan 2014 15:14:05 +0100 Subject: [PATCH] Fonction de debug pour afficher rapidement tous les linked_fields --- sudoku.py | 1 + sudoku_types.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/sudoku.py b/sudoku.py index 72cd551..f73e0ac 100755 --- a/sudoku.py +++ b/sudoku.py @@ -202,6 +202,7 @@ class Grid(object): if __name__ == "__main__": basic = sudoku_types.BasicSudoku() samurai = sudoku_types.Samurai() + #samurai.debug(True) #values = [i for i in sudoku_types.examples.hard] #values = [i for i in "0"*369] values = quick_input() diff --git a/sudoku_types.py b/sudoku_types.py index 0547189..c34e7c8 100644 --- a/sudoku_types.py +++ b/sudoku_types.py @@ -24,6 +24,13 @@ class SudokuType(object): field = self.linked_fields[field] values = [rouge + "X" + rien if i in field else "_" for i in range(self.size)] return self.render(values, False) + + def debug(self, pause=False): + """Affiche successivement tous les linked_fields""" + for f in self.linked_fields: + print self.render_field(f) + if pause: + raw_input(u"…".encode("utf-8")) class BasicSudoku(SudokuType): size = 81 -- 2.39.2