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

Contents of /queensgui/src/containermnvector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6 - (show annotations) (download)
Fri Jul 20 09:54:09 2007 UTC (16 years, 9 months ago) by torben
File size: 2651 byte(s)
No need for config control of this IDE-generated file


1 /***************************************************************************
2 * Copyright (C) 2005 by Torben Nielsen *
3 * torben@t-hoerup.dk *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #include "containermnvector.h"
21
22 #include <memory>
23
24 ContainerMNVector::ContainerMNVector(GUIUpdate* update)
25 : ContainerVector(update)
26 {
27 }
28
29
30 ContainerMNVector::~ContainerMNVector()
31 {
32 }
33
34 void ContainerMNVector::uniqueSolutions()
35 {
36 std::vector< boost::shared_ptr<Solution> > buf;
37 buf.reserve(solutions.size() / 10);
38 for (unsigned int i=0; i<solutions.size(); i++) {
39 if (m_halt)
40 break;
41
42 unsigned int j;
43 for (j=0; j<buf.size(); j++) {
44 if (m_halt)
45 break;
46 std::auto_ptr<Solution> tmp ( solutions[i]->copy() ) ;
47
48 if (*tmp == *buf[j])
49 break;
50 tmp->rotate90();
51
52 if ( *tmp == *buf[j])
53 break;
54
55 tmp->rotate90();
56 if (*tmp == *buf[j])
57 break;
58
59 tmp->rotate90();
60 if (*tmp == *buf[j])
61 break;
62
63 tmp->mirror();
64 if (*tmp == *buf[j])
65 break;
66
67 tmp->rotate90();
68 if (*tmp == *buf[j])
69 break;
70
71 tmp->rotate90();
72 if (*tmp == *buf[j])
73 break;
74
75 tmp->rotate90();
76 if (*tmp == *buf[j])
77 break;
78 }
79 if ( j == buf.size() )
80 { // hvis j==buf.size() fandt vi ingen duplicates i buf
81 buf.push_back( solutions[i] );
82 m_uniqueRemoved++;
83 m_update->duplicateRemoved();
84 }
85 }
86 solutions = buf;
87
88 }

Properties

Name Value
svn:eol-style native
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20