-
Notifications
You must be signed in to change notification settings - Fork 0
/
Move.h
72 lines (45 loc) · 1.95 KB
/
Move.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
//
// Created by mfbut on 10/26/2019.
//
#ifndef ECS_36B_HOMEWORK_MOVE_H
#define ECS_36B_HOMEWORK_MOVE_H
#include <string>
#include "Cards/Card.h"
namespace Uno {
class Player;
class GameOfUno;
enum class MoveType {
PLAY_CARD, DRAW, HELP_REQUEST, CALLOUT, QUIT, PASS, UNKNOWN
};
class Move {
public:
virtual void make() = 0;
Move(Player &maker, GameOfUno &gameState);
static Move* GetMoveFromUser(Player &maker, GameOfUno &gameState);
bool endsTurn() const;
private:
static void DisplayPrompt(const Player &maker);
//does the string represent this type of move?
static bool RepresentsValidMove(const std::string &line);
static bool RepresentsHelpRequest(const std::string &line);
static bool RepresentsQuit(const std::string &line);
static bool RepresentsPlayCard(const std::string &line);
static bool RepresentsCallOut(const std::string &line);
static bool RepresentsDraw(const std::string &line);
static bool RepresentsPass(const std::string &line);
//change a string representing a move into a Move object
static Move* toMove(const std::string &stringMove, Uno::Player &maker, GameOfUno &gameState);
static Move* CreatePlayCardMove(const std::string &stringMove, Player &maker, GameOfUno &gameState);
static Move* CreateCallOutMove(const std::string &stringMove, Player &maker, GameOfUno &gameState);
static Move* CreateUnknownMove(Player &maker, GameOfUno &gameState);
static Move* CreateQuit(Player &maker, GameOfUno &gameState);
static Move* CreateHelpRequest(Player &maker, GameOfUno &gameState);
static Move* CreateDraw(Player &maker, GameOfUno &gameState);
static Move* CreatePass(Player &maker, GameOfUno &gameState);
protected:
Player &maker;
GameOfUno &gameState;
bool _endsTurn;
};
}
#endif //ECS_36B_HOMEWORK_MOVE_H