示例#1
0
void recurGraph(byte *g) {
  int res,i,j;
  byte buf[W*H];

  res=complete(g);

  if(res==-1) return;
  if(res==1) {
    if(isMin(g)) {
      outGraph(g);
      testGraph(g);
      printf("ok\n");
      return;
    }//if
  }//if
  for(i=0; i<H*W; i++) {
    for(j=0; j<4; j++) {
      if((g[i]&(1<<j))&&(g[i]&(16<<j))) {
        copy(g,buf);
        buf[i]-=(1<<j);
        recurGraph(buf);
        copy(g,buf);
        buf[i]-=(16<<j);
        recurGraph(buf);
        return;
      }//if
    }//for
  }//for
}//recurGraph
MainWindow::MainWindow(QWidget* parent)
    :QMainWindow(parent)
{
    GUI();
    Buttons();
    outGraph();
    matrixSize = 0;
}
void MainWindow::slot_pb_ok()
{
    emit clearMatrix();
    slot_set_table(m_le_countTops->text());
    clear();
    int countTops = m_le_countTops->text().toInt();
    for(int i = STEP_SIZE; i <= countTops; i+=STEP_SIZE) {
        slot_set_table(QString::number(i));
        for(int k = 0; k < SAMPLE_SIZE; k++) {
            slot_LoadData(i);
            calcFloid();
            m_math->dijkstra();
            m_math->randomSearch();
        }
        steps << (double)i;
    }
    outGraph();
    //m_lb_resultOut->setText(QString::number(result, 'i', 0));
}