00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __MOVEMENT_ANALYSATOR_H__
00022 #define __MOVEMENT_ANALYSATOR_H__
00023
00024 #include <vector>
00025
00026 class problem_c;
00027 class disassemblerNode_c;
00028 class movementCache_c;
00029 class assembly_c;
00030 class countingNodeHash;
00031
00042 class movementAnalysator_c {
00043
00044 private:
00045
00046
00047
00048
00049
00050
00051
00052 unsigned int * matrix;
00053 unsigned int * movement;
00054 int * weights;
00055 unsigned int piecenumber;
00056
00057 movementCache_c * cache;
00058
00059 countingNodeHash * nodes;
00060
00061
00062
00063
00064 int nextpiece, next_pn, nextstate, nextpiece2, state99nextState;
00065 unsigned int nextdir;
00066 unsigned int maxstep, nextstep;
00067 disassemblerNode_c * state99node;
00068 disassemblerNode_c * searchnode;
00069 const std::vector<unsigned int> * pieces;
00070
00071 void prepare(void);
00072 bool checkmovement(unsigned int maxPieces, unsigned int nextstep);
00073 disassemblerNode_c * newNode(unsigned int amount);
00074 disassemblerNode_c * newNodeMerge(const disassemblerNode_c *n0, const disassemblerNode_c *n1);
00075
00076 public:
00077
00083 movementAnalysator_c(const problem_c *puz);
00084 ~movementAnalysator_c(void);
00085
00086
00087
00088
00089
00090
00091
00092
00093 void init_find(disassemblerNode_c * nd, const std::vector<unsigned int> & pieces);
00094 disassemblerNode_c * find(void);
00095
00096 void completeFind(disassemblerNode_c * searchnode, const std::vector<unsigned int> & pieces, std::vector<disassemblerNode_c*> * result);
00097
00098
00099 disassemblerNode_c * findMatching(disassemblerNode_c * nd, const std::vector<unsigned int> & pcs, unsigned int piece, int dx, int dy, int dz);
00100
00101 private:
00102
00103
00104 movementAnalysator_c(const movementAnalysator_c&);
00105 void operator=(const movementAnalysator_c&);
00106
00107 };
00108
00109 #endif