-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMove.h
More file actions
41 lines (29 loc) · 899 Bytes
/
Move.h
File metadata and controls
41 lines (29 loc) · 899 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
#ifndef CODECUP_MOVE_H
#define CODECUP_MOVE_H
#include <iostream>
typedef unsigned char coord;
struct Coords {
coord row;
coord column;
Coords();
Coords(coord row, coord column);
bool operator==(const Coords& coords) const;
Coords operator-(const Coords& otherCoords) const;
Coords operator+(const Coords& otherCoords) const;
Coords mirror() const;
};
enum SlideDirection {
SD_UP, SD_DOWN, SD_LEFT, SD_RIGHT
};
std::ostream& operator<<(std::ostream& ostream, const Coords& coords);
std::ostream& operator<<(std::ostream& ostream, const SlideDirection& direction);
std::istream& operator>>(std::istream& istream, SlideDirection& direction);
union Move {
Coords coords;
SlideDirection direction;
Move();
Move(const Coords& coords);
Move(coord row, coord column);
Move(const SlideDirection& direction);
};
#endif //CODECUP_MOVE_H