Skip to content
Snippets Groups Projects
Commit 14ba82c6 authored by Silas Dohm's avatar Silas Dohm
Browse files

backtracking

parent c7b365eb
Branches
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ Window::Window(QWidget *parent) ...@@ -20,7 +20,7 @@ Window::Window(QWidget *parent)
connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearButtonClicked())); connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearButtonClicked()));
m_slider = new QSlider(this); m_slider = new QSlider(this);
m_slider->setRange(0, 5000); m_slider->setRange(5, 2000);
m_slider->setOrientation(Qt::Horizontal); m_slider->setOrientation(Qt::Horizontal);
m_slider->setValue(m_delay); m_slider->setValue(m_delay);
connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
...@@ -89,6 +89,10 @@ void Window::solveButtonClicked() ...@@ -89,6 +89,10 @@ void Window::solveButtonClicked()
delay(m_delay); delay(m_delay);
if (backtracking) if (backtracking)
{ {
hist.back().cell->highlight("#0000ff");
repaint(); // draw cells again
delay(m_delay);
hist.back().cell->clearHighlight();
hist.back().cell->un(); hist.back().cell->un();
if (hist.back().index.size() == 0) if (hist.back().index.size() == 0)
{ {
...@@ -139,7 +143,7 @@ void Window::solveButtonClicked() ...@@ -139,7 +143,7 @@ void Window::solveButtonClicked()
c->highlight("#ff0000"); c->highlight("#ff0000");
} }
repaint(); // draw cells again repaint(); // draw cells again
delay(m_delay+20000); delay(m_delay);
for (auto &c : b) for (auto &c : b)
{ {
c->clearHighlight(); c->clearHighlight();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment