From fa8d032a5dbe115f15dc1e5f992f2065957a868e Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Wed, 24 Feb 2016 10:12:32 -0800 Subject: add in show solution, but not undo button --- oo.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/oo.py b/oo.py index e1f2e4a..088e426 100644 --- a/oo.py +++ b/oo.py @@ -887,10 +887,12 @@ class ooPlay: " including fixed", {})} ), - "G": ("New | Quit", + "G": ("New | Quit | Solve", {"N": ("use n to start a new game", {}), "Q": ("use q to quit the program", + {}), + "S": ("use S to show a solution", {})} ), "T": ("Show errors | Inverted | Toroidal | eXtra hard", @@ -963,12 +965,19 @@ class ooPlay: self.new_game() elif inp in "H": self.write_help() - elif inp in "Ss": + elif inp in "S": + self.write("show a solution") + for position in self.fixed: + self.fixed[position] = False + self.puzzle.set_data_from_edges(data='pieces') + self.display() + self.write() + elif inp in "s": self.write("do NOT "*self.show_errors + "show errors") self.show_errors = not self.show_errors self.display() self.write() - #TODO: add in show solution, with undo option + #TODO: add in an undo button elif inp in "Ii": self.write("puzzle is now" + " NOT"*self.inverted -- cgit v1.2.3-54-g00ecf