-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsixtyonegameboardinfo.h
97 lines (72 loc) · 2.48 KB
/
sixtyonegameboardinfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
**
**
** SixtyOneGameBoardInfo can tell us the infomation of a gameboard
** with 61 balls.
**
*/
#ifndef SIXTYONEGAMEBOARDINFO_H
#define SIXTYONEGAMEBOARDINFO_H
#include "abstractgameboardinfo.h"
#include <QVector>
#include <QPointF>
/**
* @brief A class which tells us the infomation of a gameboard with 61 balls.
*/
class SixtyOneGameBoardInfo : public AbstractGameBoardInfo
{
public:
// Width of the gameboard
virtual int width();
// Height of the gameboard
virtual int height();
// Radius of the ball
virtual double ballR();
// Number of the balls
virtual int totalBallCounts();
// Number of chains
virtual int chainNumber();
// The column number of the item with the index
virtual int columnOfIndex(int index);
// The row number of the item with the index
virtual int rowOfIndex(int index);
// Left Top of the item with the index
virtual QPointF positionOfIndex(int index);
// Index of the near by position in 6 directions
virtual int leftIndex(int index);
virtual int leftUpIndex(int index);
virtual int rightUpIndex(int index);
virtual int rightIndex(int index);
virtual int rightDownIndex(int index);
virtual int leftDownIndex(int index);
// Index of the first in the chain
virtual int firstOfChain(int index);
// Index of the near by position
virtual int nearbyIndex(int index, int direction);
// The chains to reload items(from inner to outter
virtual const QVector<QVector<int> >& chains();
// Indexes around the index
// At most 6 indexes
// The order is left, leftUp, rightUp, right, rightDown, leftDown
virtual QVector<int> chainAroundIndex(int index);
// Whether the index can be a center to rotate
virtual bool canBeRotateCenter(int index);
// Whether the index is a joint of the chains(circles)
virtual bool isJoint(int index);
// The index of the item at the position of the scene
virtual int indexOfPosition(QPointF position);
// The index of the item at the position of the row and column
virtual int indexOfPosition(int row, int column);
// Index of the first/last position in 6 directions
virtual int firstOfRow(int row);
virtual int lastOfRow(int row);
virtual int firstOfLeftUp(int index);
virtual int lastOfLeftUp(int index);
virtual int firstOfLeftDown(int index);
virtual int lastOfLeftDown(int index);
// Inverval between two layers
virtual double intervalBetweenTwoLayers();
// Center position of the gameboard
virtual QPointF centerPos();
};
#endif // SIXTYONEGAMEBOARDINFO_H