-
Notifications
You must be signed in to change notification settings - Fork 0
/
tuffle.h
34 lines (28 loc) · 940 Bytes
/
tuffle.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
#include <string>
#include <vector>
#include "dictionary.h"
#include "gamestate.h"
#include "server_utils/crow_all.h"
#ifndef TUFFLE_H
#define TUFFLE_H
class TuffleGame {
public:
TuffleGame(Dictionary dict)
: dictionary_(dict), game_state_(dict.GetRandomTuffle()) {}
// Called by the Tuffle frontend when the user clicks "Next Tuffle".
void NewGame();
// Called by the Tuffle frontend when the user enters a letter.
void LetterKeyPressed(char key);
// Called by the Tuffle frontend when the user submits a guess.
void EnterKeyPressed();
// Called by the Tuffle frontend when the presses backspace.
void DeleteKeyPressed();
// GameStateInJson returns a JSON object representing the game state.
// This is used to send the game state to the Tuffle Frontend in a readable
// format.
crow::json::wvalue GameStateInJson();
private:
GameState game_state_;
Dictionary dictionary_;
};
#endif // TUFFLE_H