Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Games > Puzzle

    YasSS 0.4.8

    Download button

    Downloads: 449  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.5/5)
    17 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Moritz Lenz | More programs
    GPL / FREE
    June 21st, 2007, 19:35 GMT
    ROOT / Games / Puzzle

     Read user reviews (0)  Refer to a friend  Subscribe

    YasSS description

    YasSS is a command line C++ program that solves given Sudokus.

    YasSS is a command line C++ program that solves given Sudokus.

    The actual work is done in a class the encapsulates all the functionality, so it should be easy to set up another GUI for it.

    How It Works

    YasSS stores the Sudoku field in a two-dimensional array. For each cell there is stored which numbers can be entered there.

    The actual solver is discussed below.

    Header File of Class Sudoku

    If a cell contains a zero, it is empty.

    #ifndef _MORITZ_FIELD_
    #define _MORITZ_FIELD_
    #include < iostream >

    // a Sudoku playing field implemented as a 2d fixed size array
    // contains consistency checks and a solver.
    class sudoku {
    public:
    sudoku();
    // creates a field with in ital data. 0 means "not set".
    // Note that the first coordinate is considered as x, so if
    // you create an array char f= {{1 ,2 ...}, {..}} you will get
    // the transposed sudoku field. but don't worry, sudoku is
    // invariant under transposition
    sudoku(char init_data[9][9]);
    sudoku(char* init_data);

    // creates a field with initial data. 0 means "not set".
    // Note that the first coordinate is considered as x, so if
    // you create an array char f= {{1 ,2 ...}, {..}} you will get
    // the transposed sudoku field. but don't worry, sudoku is
    // invariant under transposition
    sudoku(int init_data[9][9]);

    // generates a rather simplistic output to the given stream
    // call as pretty_print(cout) or something like that...
    void pretty_print(std::ostream &handle);

    // just print all chars in one row
    void print(std::ostream &handle);

    // sets item (x, y) to val
    // assumes that it is doesn't lead to an intermediate
    // conflict with sudoku rules
    // which is equivalent to saying it requires
    // allowed_set(val, x, y) to be true
    void set_item(char val, int x, int y);

    // get entry at position (x, y)
    // 0 means "unset"
    int get_item(int x, int y);

    // returns true if it doesn't lead to a direct error if you
    // set (x, y) to val
    // If data[x][y] != 0 the return value is
    // true if val == data[x][y]
    bool allowed_set(char val, int x, int y);

    // try to solve the puzzle. Returns true on success.
    bool solve();

    // returns true if there is no zero entry left, e.g. the
    // problem is solved correctly.
    bool is_solved();

    // returns true if there is no possibility to continue without
    // violating rule
    bool is_stuck();
    protected:

    // contains 0 for unset values and the corresponding value
    // if the value is set
    char data[9][9];

    // allowed[x][y][i] is true if and only if it is possible to
    // set data[x][y] to i+1 without conjuring an immediate
    // collision.
    // If data[x][y] == i != 0 then allowed[x][y][i] is true,
    // allowed[x][y][j] = false for j != i
    bool allowed[9][9][9];
    bool simple_solve();
    bool simple_solve1();
    bool simple_solve2();
    // returns either an is_solved or a stuck() version of *this
    bool backtrack();
    void null_init();

    int recursion_depth;
    void set_recursion_depth(int rd) {recursion_depth = rd;};
    };

    What's New in This Release:

    · This release adds an option to generate Sudokus with a random number of initial clues.



    Product's homepage

      


    TAGS:

    solves Sudoku | puzzle game | sudoku puzzle | YasSS | Sudoku | solver

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM