-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiece.h
68 lines (46 loc) · 1.35 KB
/
Piece.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
#ifndef PIECE_H
#define PIECE_H
#include <string>
#include <memory>
class Sea;
class Landlock;
class Coastal;
class Piece {
public:
virtual const std::string& get_type_string() const = 0;
virtual bool can_occupy(std::shared_ptr<const Sea>& sea) const = 0;
virtual bool can_occupy(std::shared_ptr<const Landlock>& landlock) const = 0;
virtual bool can_occupy(std::shared_ptr<const Coastal>& coastal) const = 0;
private:
};
class Army : Piece {
public:
virtual const std::string& get_type_string() const override
{
static const std::string type_string = std::string("A");
return type_string;
}
bool can_occupy(std::shared_ptr<const Sea>& sea) const override
{ return false; }
bool can_occupy(std::shared_ptr<const Landlock>& landlock) const override
{ return true; }
bool can_occupy(std::shared_ptr<const Coastal>& coastal) const override
{ return true; }
private:
};
class Fleet : Piece {
public:
virtual const std::string& get_type_string() const override
{
static const std::string type_string = std::string("F");
return type_string;
}
bool can_occupy(std::shared_ptr<const Sea>& sea) const override
{ return true; }
bool can_occupy(std::shared_ptr<const Landlock>& landlock) const override
{ return false; }
bool can_occupy(std::shared_ptr<const Coastal>& coastal) const override
{ return true; }
private:
};
#endif // PIECE_H