/[projects]/queensgui/src/queens.cpp
ViewVC logotype

Diff of /queensgui/src/queens.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4 by torben, Thu Jul 19 23:44:01 2007 UTC revision 5 by torben, Fri Jul 20 01:22:53 2007 UTC
# Line 48  bool Queens::solve(int row, bool findAll Line 48  bool Queens::solve(int row, bool findAll
48          if (m_blocked == true)          if (m_blocked == true)
49                  return false;                  return false;
50          for (int col=0; col<m_size; col++) {          for (int col=0; col<m_size; col++) {
51    
52                  if (checkCols(row,col) == true &&                  if (checkCols(row,col) == true &&
53                                  checkCross1(row,col) == true &&                                  checkCross1(row,col) == true &&
54                                  checkCross2(row,col) == true) {                                  checkCross2(row,col) == true)
55                    {
56    
57                                                    
58                          m_solution->setMatrix(row,col,true);                          m_solution->setMatrix(row,col,true);
59                                                    
60                          if (row == (m_size-1) ) {                          if (row == (m_size-1) )
61                            {
62                                  if (!findAll)                                  if (!findAll)
63                                          return true;                                          return true;
64                                  else {                                  else
65                                    {
66                                          m_solutions->addSolution( m_solution->copy() );                                          m_solutions->addSolution( m_solution->copy() );
67                                          m_parent->foundSolution();                                          m_parent->foundSolution();
68                                  }                                  }

Legend:
Removed from v.4  
changed lines
  Added in v.5

  ViewVC Help
Powered by ViewVC 1.1.20