YasSS

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

YasSS Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Moritz Lenz
  • Publisher web site:
  • http://moritz.faui2k3.org/en/mowyw

YasSS Tags


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 WorksYasSS 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 SudokuIf 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); 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); // 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 != 0 the return value is // true if val == data 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; // allowed is true if and only if it is possible to // set data to i+1 without conjuring an immediate // collision. // If data == i != 0 then allowed is true, // allowed = false for j != i bool allowed; 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.


YasSS Related Software