01: #if !defined(AFX_PIECE_H__204B6BD7_A5A9_4AEE_9C6C_C7E36E16985B__INCLUDED_)
02: #define AFX_PIECE_H__204B6BD7_A5A9_4AEE_9C6C_C7E36E16985B__INCLUDED_
03:
04: #if _MSC_VER > 1000
05: #pragma once
06: #endif
07:
08: class CPiece
09: {
10: int NumCubes;
11: int NumRotations;
12: int TotalNumRotations;
13: CPoint *pRotation;
14: int *pRotationListXYZ[3*4*5];
15: int NumRotationsXYZ[3*4*5];
16:
17: public:
18: CPiece(int NumberOfCubes, int *Coordinates);
19: ~CPiece();
20:
21: int GetNumCubes() { return NumCubes; }
22: int GetNumRotations() { return NumRotations; }
23: int GetTotalNumRotations() { return TotalNumRotations; }
24: void SetNumRotations(int x) { NumRotations = x; }
25: void CreateRotations();
26: void CreateTranslations();
27: bool BoxFit(int x, int y, int z, int rot);
28: void AddRotation(CPoint *pNewRotation);
29: bool Compare(CPoint *p1, CPoint *p2);
30: void SortCubes(CPoint *pCubes);
31: void SymmetryElimination();
32: bool CheckRotation(int rot, int x, int y, int z);
33: void DeleteRotation(int index, int adr);
34: bool GetDegeneration(int i, int adr);
35: CPoint *GetRotation(int rot, int cube) { return &(pRotation[GetNumCubes()*rot + cube]); }
36: unsigned __int64 GetRotation64(int index, int adr);
37:
38: inline int GetNumRotationsXYZ(int adr)
39: {
40: return NumRotationsXYZ[adr];
41: }
42:
43: inline int GetRotationNumber(int index, int adr)
44: {
45: return (pRotationListXYZ[adr])[index] & 255;
46: }
47: };
48:
49: #endif