From: Vincent Le Gallic Date: Thu, 23 Jan 2014 14:14:05 +0000 (+0100) Subject: Fonction de debug pour afficher rapidement tous les linked_fields X-Git-Url: http://gitweb.pimeys.fr/?a=commitdiff_plain;p=sudoku.git Fonction de debug pour afficher rapidement tous les linked_fields --- 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