Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

solution_holder.h

00001 /*
00002  *   EasySok --- A(nother) sokoban game for KDE.
00003  *
00004  *   Copyright (C) 2001 by Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
00005  *
00006  *   This program is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License version 2 as
00008  *   published by the Free Software Foundation.
00009  *
00010  *   This program is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with this program; if not, write to the Free Software
00017  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 
00021 #ifndef EASYSOK_SOLUTION_HOLDER_INC_GUARD_H
00022 #define EASYSOK_SOLUTION_HOLDER_INC_GUARD_H
00023 
00024 
00025 #include <map>
00026 #include <vector>
00027 
00028 #include <qdatetime.h>
00029 #include <qstring.h>
00030 #include <qstringlist.h>
00031 
00032 #include "compressed_map.h"
00033 #include "movements.h"
00034 
00035 
00036 
00037 
00050 class SolutionHolder
00051 {
00052 
00053 public:
00054 
00059     static void load();
00060 
00061 
00066     static void save();
00067 
00068 
00077     static int getIndexForMap(CompressedMap const & map);
00078 
00079 
00086     static bool hasSolution(CompressedMap const & map);
00087 
00088 
00093     static bool hasSolution(int index);
00094 
00095 
00102     static int numberOfSolutions(CompressedMap const & map);
00103 
00104 
00109     static int numberOfSolutions(int index);
00110 
00111 
00119     static Movements const & movements(CompressedMap const & map, int solution);
00120 
00121 
00126     static Movements const & movements(int index, int solution);
00127 
00128 
00136     static int pushesInSolution(CompressedMap const & map, int solution);
00137 
00138 
00143     static int pushesInSolution(int index, int solution);
00144 
00145 
00153     static int linearPushesInSolution(CompressedMap const & map, int solution);
00154 
00155 
00160     static int linearPushesInSolution(int index, int solution);
00161 
00162 
00170     static int gemChangesInSolution(CompressedMap const & map, int solution);
00171 
00172 
00177     static int gemChangesInSolution(int index, int solution);
00178 
00179 
00187     static int movesInSolution(CompressedMap const & map, int solution);
00188 
00189 
00194     static int movesInSolution(int index, int solution);
00195 
00196 
00204     static QDateTime const & dateOfSolution(CompressedMap const & map, int solution);
00205 
00206 
00211     static QDateTime const & dateOfSolution(int index, int solution);
00212 
00213 
00221     static QString const & infoOfSolution(CompressedMap const & map, int solution);
00222 
00223 
00228     static QString const & infoOfSolution(int index, int solution);
00229 
00230 
00245     static int addSolution(CompressedMap const & map, Movements const & moves,
00246                            int number_of_pushes, int number_of_linear_pushes,
00247                            int number_of_gem_changes, int number_of_moves, QString const & info);
00248 
00249 
00254     static int addSolution(int index, Movements const & moves,
00255                            int number_of_pushes, int number_of_linear_pushes,
00256                            int number_of_gem_changes, int number_of_moves, QString const & info);
00257 
00258 
00272     static int addSolution(CompressedMap const & map, Movements const & moves, int number_of_pushes,
00273                            int number_of_linear_pushes, int number_of_gem_changes,
00274                            int number_of_moves, QString const & info, QDateTime const & date_time);
00275 
00276 
00281     static int addSolution(int index, Movements const & moves, int number_of_pushes,
00282                            int number_of_linear_pushes, int number_of_gem_changes,
00283                            int number_of_moves, QString const & info, QDateTime const & date_time);
00284 
00285 
00294     static void changeSolutionInfo(CompressedMap const & map, int solution, QString const & info);
00295 
00296 
00301     static void changeSolutionInfo(int index, int solution, QString const & info);
00302 
00303 
00311     static void deleteSolution(CompressedMap const & map, int solution);
00312 
00313 
00318     static void deleteSolution(int index, int solution);
00319 
00320 
00327     static bool hasLastAttempt(CompressedMap const & map);
00328 
00329 
00336     static Movements const & lastAttempt(CompressedMap const & map);
00337 
00338 
00343     static Movements const & lastAttempt(int index);
00344 
00345 
00353     static void setLastAttempt(CompressedMap const & map, Movements const & movements);
00354 
00355 
00360     static void setLastAttempt(int index, Movements const & movements);
00361 
00362 
00363 private:
00364 
00369     static std::map<CompressedMap, int> s_map_indices;
00370 
00371 
00376     static std::vector<std::vector<Movements> > s_solutions;
00377 
00378 
00383     static std::vector<Movements> s_last_attempts;
00384 
00385 
00390     static std::vector<std::vector<int> > s_pushes;
00391 
00392 
00397     static std::vector<std::vector<int> > s_moves;
00398 
00399 
00404     static std::vector<std::vector<int> > s_linear_pushes;
00405 
00406 
00411     static std::vector<std::vector<int> > s_gem_changes;
00412 
00413 
00418     static std::vector<std::vector<QDateTime> > s_dates;
00419 
00420 
00425     static std::vector<QStringList > s_infos;
00426 
00427 
00432     static bool s_was_modified;
00433 };
00434 
00435 
00436 #endif

Generated at Sun Jan 6 18:49:09 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001