ADS
Algorithms and Data Structures
Toggle main menu visibility
Loading...
Searching...
No Matches
Sudoku.h
Go to the documentation of this file.
1
/*--------------------------------------------------------------------------*/
2
/*----------------------------- File Sudoku.h ------------------------------*/
3
/*--------------------------------------------------------------------------*/
29
/*--------------------------------------------------------------------------*/
30
/*----------------------------- DEFINITIONS --------------------------------*/
31
/*--------------------------------------------------------------------------*/
32
33
#ifndef __ADS_Sudoku
34
#define __ADS_Sudoku
35
/* self-identification: #endif constant */
36
37
/*--------------------------------------------------------------------------*/
38
/*------------------------------ INCLUDES ----------------------------------*/
39
/*--------------------------------------------------------------------------*/
40
41
#include <cstddef>
42
#include "
ADS/Contract.h
"
43
44
#include <vector>
45
46
/*--------------------------------------------------------------------------*/
47
/*--------------------------- NAMESPACE ------------------------------------*/
48
/*--------------------------------------------------------------------------*/
49
50
namespace
ADS
51
{
52
53
using
Grid
= std::vector< std::vector< int > >;
54
74
inline
bool
check
(
const
Grid
& S , std::size_t x , std::size_t y ,
int
c );
75
102
inline
bool
sudoku
(
Grid
& S , std::size_t i = 0 );
103
104
/*--------------------------------------------------------------------------*/
105
106
}
// end( namespace ADS )
107
108
/*--------------------------------------------------------------------------*/
109
/*-------------------------- IMPLEMENTATION --------------------------------*/
110
/*--------------------------------------------------------------------------*/
111
112
#include "ADS/backtrack/impl/Sudoku.tpp"
113
114
/*--------------------------------------------------------------------------*/
115
116
#endif
/* Sudoku.h included */
117
118
/*--------------------------------------------------------------------------*/
119
/*--------------------------- End File Sudoku.h ----------------------------*/
120
/*--------------------------------------------------------------------------*/
Contract.h
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
ADS::sudoku
bool sudoku(Grid &S, std::size_t i=0)
fills the empty squares of from the square number on, in the order of the rows; true if it can
ADS::check
bool check(const Grid &S, std::size_t x, std::size_t y, int c)
whether can be written in the square of , i.e., it is not on its row, its column or its block
ADS
Definition
ADT.h:96
ADS::Grid
std::vector< std::vector< int > > Grid
the squares, 0 empty
Definition
Sudoku.h:53
ADS
backtrack
Sudoku.h
Generated by
1.17.0