diff --git a/window.cpp b/window.cpp index 14d137edb4d76d581f8d4085138ff3a08433e808..d023533c21289e7b67c09f7e590dce4693e36a76 100644 --- a/window.cpp +++ b/window.cpp @@ -58,6 +58,8 @@ Window::Window(QWidget *parent) { for (int y1 = b; y1 < b + 3; y1++) { + if(x1 == x || y1 == y) + continue; connect(&m_cell[x + y * 9], SIGNAL(update(int)), &m_cell[x1 + y1 * 9], SLOT(removeOption(int))); connect(&m_cell[x + y * 9], SIGNAL(undo(int)), &m_cell[x1 + y1 * 9], SLOT(addOption(int))); @@ -74,6 +76,8 @@ void Window::solveButtonClicked() srand(time(NULL)); //random seed while (1) { + repaint(); // draw cells again + QThread::msleep(m_delay); if (backtracking) { hist.back()->cell->un(); @@ -84,6 +88,8 @@ void Window::solveButtonClicked() } backtracking = false; int choiceNr = rand() % hist.back()->index.size(); // choose a random number; + repaint(); // draw cells again + QThread::msleep(m_delay); hist.back()->cell->collapse(hist.back()->index[choiceNr]); // collapse cell with chosen number; std::vector<int>::iterator it; it = hist.back()->index.begin() + choiceNr; @@ -128,8 +134,6 @@ void Window::solveButtonClicked() hist.push_back(new History(b[choiceCell], b[choiceCell]->index, choiceNr)); b[choiceCell]->collapse(b[choiceCell]->index[choiceNr]); // collapse that random cell with chosen number; } - repaint(); // draw cells again - QThread::msleep(m_delay); } // qInfo("%d---:)"); } @@ -141,7 +145,6 @@ void Window::clearButtonClicked() if (x.collapsed) x.un(); } - repaint(); return; } void Window::setValue(int s)