forked from uCloudCastle/ShenJingMao
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcatalgorithm.h
More file actions
48 lines (39 loc) · 997 Bytes
/
catalgorithm.h
File metadata and controls
48 lines (39 loc) · 997 Bytes
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
#ifndef CATALGORITHM_H
#define CATALGORITHM_H
#include <QObject>
#include "helper.h"
enum HardLevel{
Eazy = 1,
Normal,
Hard
};
enum NormalDirMode
{
DirLeftFirst,
DirRandom
};
class CatAlgorithm : public QObject
{
Q_OBJECT
public:
explicit CatAlgorithm(QObject *parent = 0);
Q_PROPERTY(int hardLv READ hardLv WRITE setHardLv NOTIFY hardLvChanged)
Q_INVOKABLE int getNextDirection(int catPos, QList<int> map);
int hardLv() const { return m_hardLv; }
void setHardLv(int putin) {
m_hardLv = putin;
if ( m_hardLv != Eazy && m_hardLv != Normal && m_hardLv != Hard ) {
m_hardLv = Eazy;
}
emit hardLvChanged();
}
signals:
void hardLvChanged();
private:
int EazyMode(int catPos, QList<int>& list);
int NormalMode(int catPos, QList<int>& list, NormalDirMode dm);
int HardMode(int catPos, QList<int>& list);
int m_hardLv;
QScopedPointer<Helper> m_helper;
};
#endif // CATALGORITHM_H