Kakuro Class Reference
[Scripts for problems]
Inherits Example.
Detailed Description
Example: KakuroAnother puzzle in the style of Sudoku.
Definition at line 512 of file kakuro.cc.
Kakuro specifications | |
Each specification starts with two integers for width and height, followed by entries for vertical constraints, an integer -1 (signalling the end of the vertical constraints), entries for the horizontal constraints, and, finally, an integer -1. Each entry consists of four integers:
The example are taken from the website of Nikoli (from the free section). Thanks to Nikoli for their great puzzles and their brilliant website: www.nikoli.com. | |
const int | k0 [] |
const int | k1 [] |
const int | k2 [] |
const int | k3 [] |
const int | k4 [] |
const int | k5 [] |
const int | k6 [] |
const int | k7 [] |
const int | k8 [] |
const int | k9 [] |
Public Types | |
enum | { PROP_DFA, PROP_TUPLE_SET } |
Propagation variants. More... | |
enum | { MODEL_DECOMPOSE, MODEL_COMBINE } |
Model variants. More... | |
Public Member Functions | |
IntVar & | b (int x, int y) |
Access the field at position x, y. | |
void | init (int x, int y) |
Init the field at position x, y if necessary. | |
template<class Data> | |
void | distinctlinear (Cache< Data > &dc, const IntVarArgs &x, int c, const SizeOptions &opt) |
Post a distinct-linear constraint on variables x with sum c. | |
Kakuro (const SizeOptions &opt) | |
The actual problem. | |
Kakuro (bool share, Kakuro &s) | |
Constructor for cloning s. | |
virtual Space * | copy (bool share) |
Perform copying during cloning. | |
virtual void | print (std::ostream &os) |
Print solution. | |
Protected Attributes | |
const int | w |
Width of board. | |
const int | h |
Height of board. | |
IntVarArray | _b |
Variables for board. | |
Related Functions | |
(Note that these are not member functions.) | |
const int * | examples [] |
Array of all examples. | |
template<class C> | |
C | generate (int n, int c) |
Generate specification for n distinct variables withm sum c. |
Member Enumeration Documentation
anonymous enum |
anonymous enum |
Constructor & Destructor Documentation
Kakuro::Kakuro | ( | const SizeOptions & | opt | ) | [inline] |
Kakuro::Kakuro | ( | bool | share, | |
Kakuro & | s | |||
) | [inline] |
Member Function Documentation
IntVar& Kakuro::b | ( | int | x, | |
int | y | |||
) | [inline] |
void Kakuro::init | ( | int | x, | |
int | y | |||
) | [inline] |
template<class Data>
void Kakuro::distinctlinear | ( | Cache< Data > & | dc, | |
const IntVarArgs & | x, | |||
int | c, | |||
const SizeOptions & | opt | |||
) | [inline] |
virtual Space* Kakuro::copy | ( | bool | share | ) | [inline, virtual] |
virtual void Kakuro::print | ( | std::ostream & | os | ) | [inline, virtual] |
Friends And Related Function Documentation
const int k0[] [related] |
Initial value:
{ 12,10, 2, 0, 5,16, 3, 0, 2, 4, 5, 0, 3, 6, 6, 0, 2, 4, 7, 0, 5,15, 10, 0, 3, 6, 11, 0, 3, 7, 1, 1, 3, 7, 9, 1, 5,16, 4, 2, 2, 5, 8, 2, 2, 3, 3, 3, 5,16, 6, 3, 3, 8, 5, 4, 5,15, 10, 4, 5,15, 4, 5, 2, 3, 8, 5, 2, 4, 11, 5, 3, 7, 1, 6, 3, 6, 2, 6, 3, 7, 7, 6, 3, 7, 6, 7, 2, 3, 9, 7, 2, 4, -1, 1, 1, 2, 7, 4, 1, 3, 9, 9, 1, 2, 4, 0, 2, 3, 7, 4, 2, 3, 7, 8, 2, 3, 6, 0, 3, 2, 3, 3, 3, 2, 4, 6, 3, 5,16, 0, 4, 4,10, 5, 4, 4,10, 1, 5, 2,10, 4, 5, 3, 6, 8, 5, 2, 5, 2, 6, 4,10, 7, 6, 4,12, 0, 7, 5,16, 6, 7, 2, 4, 9, 7, 2, 4, 0, 8, 3, 7, 4, 8, 3, 8, 8, 8, 3, 6, 0, 9, 2, 3, 4, 9, 3, 7, 8, 9, 2, 3, -1 }
const int k1[] [related] |
Initial value:
{ 12,10, 1, 0, 2, 4, 2, 0, 5,15, 5, 0, 5,18, 6, 0, 2,12, 7, 0, 3, 8, 10, 0, 3,24, 11, 0, 3,23, 3, 1, 2, 7, 9, 1, 3,24, 4, 2, 5,16, 8, 2, 5,35, 1, 3, 2,12, 6, 3, 3,17, 7, 4, 5,34, 10, 4, 5,34, 11, 4, 2,16, 3, 5, 3, 6, 1, 6, 3, 7, 2, 6, 3, 6, 5, 6, 3,23, 9, 6, 2,10, 6, 7, 2,14, 11, 7, 2,10, -1, 0, 1, 2, 3, 4, 1, 3,15, 9, 1, 2,16, 0, 2, 3, 6, 4, 2, 3, 7, 8, 2, 3,24, 1, 3, 4,11, 6, 3, 5,34, 0, 4, 2,14, 3, 4, 3,23, 7, 4, 2,14, 0, 5, 2, 7, 3, 5, 5,15, 9, 5, 2,17, 2, 6, 2, 6, 5, 6, 3,23, 9, 6, 2,13, 0, 7, 5,16, 6, 7, 4,30, 0, 8, 3, 6, 4, 8, 3,23, 8, 8, 3, 7, 0, 9, 2, 4, 4, 9, 3,24, 9, 9, 2,17, -1 }
const int k2[] [related] |
Initial value:
{ 12,10, 2, 0, 5,15, 3, 0, 2, 3, 7, 0, 3, 7, 8, 0, 4,23, 9, 0, 2,12, 10, 0, 3,20, 11, 0, 3, 9, 4, 1, 3, 7, 5, 1, 4,10, 1, 2, 3, 6, 6, 2, 5,15, 9, 3, 2,16, 3, 4, 2, 3, 7, 4, 4,13, 10, 4, 5,35, 11, 4, 3,23, 4, 5, 4,11, 8, 5, 3,23, 1, 6, 3,23, 2, 6, 3,14, 5, 6, 3,11, 3, 7, 2,13, 9, 7, 2,17, -1, 1, 1, 2, 4, 6, 1, 5,15, 1, 2, 4,11, 6, 2, 5,34, 0, 3, 2, 3, 3, 3, 5,15, 9, 3, 2,10, 0, 4, 2, 4, 3, 4, 3, 6, 7, 4, 2,17, 0, 5, 3, 7, 4, 5, 3, 8, 8, 5, 3,18, 2, 6, 2, 3, 5, 6, 3,11, 9, 6, 2,16, 0, 7, 2,16, 3, 7, 5,16, 9, 7, 2,17, 0, 8, 5,16, 6, 8, 4,30, 0, 9, 5,35, 8, 9, 2,17, -1 }
const int k3[] [related] |
Initial value:
{ 12,10, 3, 0, 3, 7, 4, 0, 6,21, 7, 0, 4,29, 8, 0, 2,17, 10, 0, 4,29, 11, 0, 3,23, 2, 1, 3, 6, 6, 1, 2,16, 9, 1, 4,14, 1, 2, 2, 4, 5, 2, 2, 3, 8, 3, 6,22, 3, 4, 4,10, 2, 5, 4,11, 5, 5, 4,10, 7, 5, 2,10, 10, 5, 3,24, 11, 5, 2,16, 1, 6, 3, 7, 6, 6, 2, 9, 9, 6, 3,23, 4, 7, 2, 4, -1, 2, 1, 2, 4, 6, 1, 2,17, 9, 1, 2,16, 1, 2, 3, 6, 5, 2, 6,39, 0, 3, 7,28, 8, 3, 3,24, 0, 4, 2, 3, 3, 4, 2, 3, 6, 4, 4,20, 2, 5, 2, 9, 7, 5, 2, 4, 1, 6, 4,10, 6, 6, 2, 3, 9, 6, 2,16, 0, 7, 3, 6, 4, 7, 7,42, 0, 8, 6,21, 7, 8, 3,21, 0, 9, 2, 4, 3, 9, 2, 3, 7, 9, 2,16, -1 }
const int k4[] [related] |
Initial value:
{ 20,12, 3, 0, 3,21, 4, 0, 2, 4, 5, 0, 4,11, 8, 0, 2, 8, 9, 0, 3, 7, 11, 0, 2, 3, 12, 0, 3, 6, 15, 0, 6,39, 16, 0, 2, 3, 17, 0, 3,23, 2, 1, 5,15, 6, 1, 4,10, 10, 1, 4,11, 14, 1, 4,11, 18, 1, 3, 6, 1, 2, 3,24, 7, 2, 4,14, 13, 2, 2,10, 19, 2, 2,16, 4, 3, 5,18, 8, 3, 4,10, 11, 3, 4,12, 16, 3, 5,33, 3, 4, 3,23, 9, 4, 4,29, 12, 4, 4,30, 17, 4, 3,18, 5, 5, 6,38, 13, 5, 4,29, 18, 5, 5,15, 6, 6, 4,25, 10, 6, 4,12, 14, 6, 4,28, 19, 6, 3,21, 1, 7, 2, 4, 2, 7, 3, 7, 7, 7, 2, 7, 15, 7, 4,11, 3, 8, 3,19, 8, 8, 3,24, 11, 8, 3, 7, 17, 8, 3, 6, 4, 9, 2,16, 9, 9, 2,16, 12, 9, 2,17, 16, 9, 2, 5, -1, 2, 1, 3, 7, 7, 1, 2, 4, 10, 1, 2, 4, 14, 1, 3,19, 1, 2, 5,18, 7, 2, 5,15, 13, 2, 5,16, 0, 3, 3,21, 4, 3, 3, 6, 8, 3, 2, 3, 11, 3, 4,11, 16, 3, 3,20, 0, 4, 2,14, 3, 4, 5,15, 9, 4, 2, 3, 12, 4, 4,29, 17, 4, 2, 8, 0, 5, 4,27, 5, 5, 7,42, 13, 5, 4,12, 1, 6, 4,12, 6, 6, 3, 8, 10, 6, 3,20, 14, 6, 4,29, 2, 7, 4,28, 7, 7, 7,28, 15, 7, 4,28, 0, 8, 2, 3, 3, 8, 4,11, 8, 8, 2,10, 11, 8, 5,35, 17, 8, 2,10, 0, 9, 3, 6, 4, 9, 4,30, 9, 9, 2, 3, 12, 9, 3,19, 16, 9, 3, 7, 1,10, 5,34, 7,10, 5,34, 13,10, 5,17, 2,11, 3,23, 7,11, 2,17, 10,11, 2,10, 14,11, 3, 6, -1 }
const int* examples[] [related] |
Generate specification for n distinct variables withm sum c.
Generate tuple set for n distinct variables with sum c.
Generate DFA for n distinct variables with sum c.
This function should be specialised for any type of specification.
Member Data Documentation
IntVarArray Kakuro::_b [protected] |
The documentation for this class was generated from the following file:
- examples/kakuro.cc (Revision: 5572)