From f5cbdbb1b52d615b446a84a18b7779d18820f302 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 24 Aug 2006 18:09:44 +0000 Subject: Add wording and tweak difficulty levels so that the Easy and Normal levels always generate "valid" Sudoku puzzles while Hard and Impossible are free to make Sudoku puzzles more fun/challenging (STR #1361) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5356 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 14 ++++++++------ test/sudoku.cxx | 33 +++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index b61023fab..8f80878c3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,15 +1,17 @@ CHANGES IN FLTK 1.1.8 - - Fixed filechooser to behave as documented when - file pattern changes (STR #135s9) + - Updated the Sudoku game to show a notice about Hard and + Impossible puzzles having multiple solutions which are + not a bug or error (STR #1361) + - Fixed filechooser to behave as documented when file + pattern changes (STR #1359) - Completed the global function index and added an alphabetical list of all methods (STR #1319) - Avoiding problems with some platforms that don't implement hypot() (STR #1366) - - Fixed floating point value formatting - for Fl_Spinner (STR #1331) - - Fixed Fl_Positioner callback - when released (STR #1387) + - Fixed floating point value formatting for Fl_Spinner + (STR #1331) + - Fixed Fl_Positioner callback when released (STR #1387) - Fixed WIN32 zero size window issue (STR #1387) - Fixed Sudoku window positioning (STR #1398) - Fluid Code Declarations can now handle diff --git a/test/sudoku.cxx b/test/sudoku.cxx index a328af8dd..e0b926ded 100644 --- a/test/sudoku.cxx +++ b/test/sudoku.cxx @@ -839,6 +839,23 @@ Sudoku::diff_cb(Fl_Widget *widget, void *d) { s->new_game(s->seed_); s->set_title(); + if (diff > 1) + { + // Display a message about the higher difficulty levels for the + // Sudoku zealots of the world... + int val; + + prefs_.get("difficulty_warning", val, 0); + + if (!val) + { + prefs_.set("difficulty_warning", 1); + fl_alert("Note: 'Hard' and 'Impossible' puzzles may have more than " + "one possible solution.\n" + "This is not an error or bug."); + } + } + prefs_.set("difficulty", s->difficulty_); } } @@ -866,7 +883,17 @@ Sudoku::help_cb(Fl_Widget *, void *) { "only once in each column and row. In addition, each 3x3 subgrid\n" "may only contain one of each number.

\n" - "

This version of the puzzle is Copyright 2005 by Michael R Sweet

\n" + "

This version of the puzzle is copyright 2005-2006 by Michael R\n" + "Sweet.

\n" + + "

Note: The 'Hard' and 'Impossible' difficulty\n" + "levels generate Sudoku puzzles with multiple possible solutions.\n" + "While some purists insist that these cannot be called 'Sudoku'\n" + "puzzles, the author (me) has personally solved many such puzzles\n" + "in published/printed Sudoku books and finds them far more\n" + "interesting than the simple single solution variety. If you don't\n" + "like it, don't play with the difficulty set to 'High' or\n" + "'Impossible'.

\n" "

How to Play the Game

\n" @@ -1020,7 +1047,7 @@ Sudoku::new_game(time_t seed) { } // Show N cells... - count = 10 * (5 - difficulty_); + count = 11 * (5 - difficulty_); int numbers[9]; @@ -1050,8 +1077,6 @@ Sudoku::new_game(time_t seed) { break; } } - - sound_->play('A' + t - 1); } } } -- cgit v1.2.3