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

Diff of /queensgui/src/solutionhash.cpp

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

revision 1 by torben, Thu Jul 19 21:34:15 2007 UTC revision 2 by torben, Thu Jul 19 22:26:42 2007 UTC
# Line 101  void SolutionHash::uniqueSolutionsWorker Line 101  void SolutionHash::uniqueSolutionsWorker
101                  if (m_halt)                  if (m_halt)
102                          return;                          return;
103                  match_count = 0;                  match_count = 0;
104                  Solution tmp(*i);                  Solution* tmp = (*i)->copy();
105                  if (mirror)                  if (mirror)
106                          tmp.mirror();                          tmp->mirror();
107                  for (int k=0;k<rot;k++)                  for (int k=0;k<rot;k++)
108                          tmp.rotate90();                          tmp->rotate90();
109    
110                  //unders�g kun resten af m�ngden, start ved i+1                              //unders�g kun resten af m�ngden, start ved i+1            
111                  ListIt j =i;                  ListIt j =i;
112                  j++;                  j++;
113                  for ( ; j!=solutions[bucket]->end();j++) {                  for ( ; j!=solutions[bucket]->end();j++) {
114                          if ( tmp == (*j) ) {                          if ( *tmp == *(*j) ) {
115                                  solutions[bucket]->erase(j);                                  solutions[bucket]->erase(j);
116                                  break;                                  break;
117                          }                          }
# Line 150  void SolutionHash::uniqueSolutionsWorker Line 150  void SolutionHash::uniqueSolutionsWorker
150  }  }
151  */  */
152    
153  void SolutionHash::addSolution(Solution sol)  void SolutionHash::addSolution(Solution* sol)
154  {  {
155      int hash = m_size % max_size;      int hash = m_size % max_size;
156      solutions[hash]->push_back(sol);        solutions[hash]->push_back(sol);  
157      m_size++;      m_size++;
158  }  }
159    
160  Solution SolutionHash::solution(int index)  Solution* SolutionHash::solution(int index)
161  {  {
162      int count=0;      int count=0;
163      Solution returndata;          ListIt it;
164      for (ListIt it = solutions[0]->begin(); it != solutions[0]->end(); it++, count++) {      for (it = solutions[0]->begin(); it != solutions[0]->end(); it++, count++) {
165          if (count == index) {          if (count == index) {
166              returndata =  *it ;                  break;
167              break;                  }
         }  
168      }      }
169      return returndata;      return *it;
170  }  }
171    

Legend:
Removed from v.1  
changed lines
  Added in v.2

  ViewVC Help
Powered by ViewVC 1.1.20