-
Notifications
You must be signed in to change notification settings - Fork 0
/
move.cpp
76 lines (61 loc) · 1.15 KB
/
move.cpp
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
#include "move.h"
int& MvForward::moveIndex(int& arg) const
{
return ++arg;
}
void MvForward::init()
{
m_indexInit = 0;
m_indexLimit = fieldSize();
}
int& MvBackward::moveIndex(int& arg) const
{
return --arg;
}
void MvBackward::init()
{
m_indexInit = fieldSize() - 1;
m_indexLimit = -1;
}
QPoint MvInRow::coords(int x1, int x2) const
{
return QPoint(x1, x2);
}
QPoint MvInColumn::coords(int x2, int x1) const
{
return QPoint(x1, x2);
}
MvForward::MvForward() {
m_arithmOper = std::plus<int>();
m_compare = std::less<int>();
}
MvBackward::MvBackward() {
m_arithmOper = std::minus <int>();
m_compare = std::greater<int>();
}
MvInRow::MvInRow() {
m_access = std::mem_fn(&MvInRow::getNodeRowConst);
}
MvInColumn::MvInColumn() {
m_access = std::mem_fn(&MvInColumn::getNodeColumnConst);
}
MoveLeft::MoveLeft(Playground* parent)
{
m_parent = parent;
init();
}
MoveRight::MoveRight(Playground* parent)
{
m_parent = parent;
init();
}
MoveUp::MoveUp(Playground* parent)
{
m_parent = parent;
init();
}
MoveDown::MoveDown(Playground* parent)
{
m_parent = parent;
init();
}