RosettaCodeData/Task/Nonogram-solver/C++/nonogram-solver-3.cpp

79 lines
4.3 KiB
C++

int main(){
const std::vector<std::vector<int>> Ngchq={{ 7,3,1, 1,7},
{ 1,1,2,2, 1,1},
{ 1,3,1,3,1,1, 3,1},
{ 1,3,1,1,6,1, 3,1},
{ 1,3,1,5,2,1, 3,1},
{ 1,1,2, 1,1},
{ 7,1,1,1,1, 1,7},
{ 3,3},
{1,2,3,1,1,3,1, 1,2},
{ 1,1,3,2, 1,1},
{ 4,1,4,2, 1,2},
{ 1,1,1,1,1,4, 1,3},
{ 2,1,1,1, 2,5},
{ 3,2,2,6, 3,1},
{ 1,9,1,1, 2,1},
{ 2,1,2,2, 3,1},
{ 3,1,1,1,1, 5,1},
{ 1,2, 2,5},
{ 7,1,2,1,1, 1,3},
{ 1,1,2,1,2, 2,1},
{ 1,3,1,4, 5,1},
{ 1,3,1,3,10,2},
{ 1,3,1,1, 6,6},
{ 1,1,2,1, 1,2},
{ 7,2,1, 2,5}};
const std::vector<std::vector<int>> Ggchq={{ 7,2,1,1,7},
{ 1,1,2,2,1,1},
{1,3,1,3,1,3,1,3,1},
{ 1,3,1,1,5,1,3,1},
{ 1,3,1,1,4,1,3,1},
{ 1,1,1,2,1,1},
{ 7,1,1,1,1,1,7},
{ 1,1,3},
{ 2,1,2,1,8,2,1},
{ 2,2,1,2,1,1,1,2},
{ 1,7,3,2,1},
{ 1,2,3,1,1,1,1,1},
{ 4,1,1,2,6},
{ 3,3,1,1,1,3,1},
{ 1,2,5,2,2},
{2,2,1,1,1,1,1,2,1},
{ 1,3,3,2,1,8,1},
{ 6,2,1},
{ 7,1,4,1,1,3},
{ 1,1,1,1,4},
{ 1,3,1,3,7,1},
{1,3,1,1,1,2,1,1,4},
{ 1,3,1,4,3,3},
{ 1,1,2,2,2,6,1},
{ 7,1,3,2,1,1}};
std::vector<std::string> n = {"",
"",
"",
"...##.......##.......#",
"",
"",
"",
"",
"......##..#...##..#",
"",
"",
"",
"",
"",
"",
"",
"......#....#....#...#",
"",
"",
"",
"",
"...##....##....#....##"};
Nonogram<25,25> myN(Ngchq,Ggchq,n);
if (!myN.solve()) std::cout << "I don't believe that this is a nonogram!" << std::endl;
std::cout << "\n" << myN.toStr() << std::endl;
}