[gnome-games/applygsoc2009: 72/76] -- Show puzzle info to receiver
- From: Pablo Castellano <pablog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/applygsoc2009: 72/76] -- Show puzzle info to receiver
- Date: Mon, 6 Sep 2010 02:53:16 +0000 (UTC)
commit 7e4b39450c2831363b002d4e4029aa31425babdc
Author: Pablo Castellano <pablog src gnome org>
Date: Wed Sep 1 05:27:31 2010 +0200
-- Show puzzle info to receiver
gnome-sudoku/src/lib/main.py | 14 +-------------
gnome-sudoku/src/lib/sudoku.py | 15 +++++++++++++++
2 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 0801282..231fc3f 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -590,19 +590,7 @@ class SudokuGame (gconf_wrapper.GConfWrapper):
)
return
puzzle = self._main_model.grid.virgin.to_string()
- diff = self.sudoku_maker.get_difficulty(puzzle)
- information = _("Calculated difficulty: ")
- information += diff.value_string()
- information += " (%1.2f)" % diff.value
- information += "\n"
- information += _("Number of moves instantly fillable by elimination: ")
- information += str(int(diff.instant_elimination_fillable))
- information += "\n"
- information += _("Number of moves instantly fillable by filling: ")
- information += str(int(diff.instant_fill_fillable))
- information += "\n"
- information += _("Amount of trial-and-error required to solve: ")
- information += str(len(diff.guesses))
+ information = self._difficulty.to_string()
dialog_extras.show_message(parent = self.w,
title = _("Puzzle Statistics"),
label = _("Puzzle Statistics"),
diff --git a/gnome-sudoku/src/lib/sudoku.py b/gnome-sudoku/src/lib/sudoku.py
index 18cf0c2..2e4a95c 100644
--- a/gnome-sudoku/src/lib/sudoku.py
+++ b/gnome-sudoku/src/lib/sudoku.py
@@ -817,6 +817,21 @@ class DifficultyRating:
else:
return 'easy'
+ def to_string(self):
+ information = _("Calculated difficulty: ")
+ information += self.value_string()
+ information += " (%1.2f)" % self.value
+ information += "\n"
+ information += _("Number of moves instantly fillable by elimination: ")
+ information += str(int(self.instant_elimination_fillable))
+ information += "\n"
+ information += _("Number of moves instantly fillable by filling: ")
+ information += str(int(self.instant_fill_fillable))
+ information += "\n"
+ information += _("Amount of trial-and-error required to solve: ")
+ information += str(len(self.guesses))
+ return information
+
def get_difficulty_category_name (diff_float):
return DifficultyRating.label_by_cat.get(
get_difficulty_category(diff_float),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]