-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
66 lines (55 loc) · 1.19 KB
/
Copy pathmain.cpp
File metadata and controls
66 lines (55 loc) · 1.19 KB
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
#include "common.h"
#include "world.h"
void Play(std::string& player_input, std::vector<std::string> tokens)
{
// Initialize world
std::cout << "\n";
std::cout << "You wake up inside your cell, a man knocking on your door.\n";
std::cout << "- HEY! YOUR COMBAT IS STARTING SOON! WAKE UP!\n";
std::cout << "The man walks away. You put your clothes on.\n";
std::cout << "\n";
World world;
// Game loop
while (true)
{
std::cout << "\n";
std::cout << "> ";
std::getline(std::cin, player_input);
Tokenize(player_input, tokens);
std::cout << "\n";
if (player_input == "quit")
{
break;
}
const bool finished = world.Tick(tokens);
if (finished)
{
break;
}
}
}
int main()
{
std::cout << "Welcome to Kroz the Gladiator!\n";
std::string player_input;
std::vector<std::string> tokens;
tokens.reserve(10);
while (true)
{
Play(player_input, tokens);
std::cout << "Do you want to try again?\n";
std::cout << "\n";
std::cout << "> ";
std::getline(std::cin, player_input);
Tokenize(player_input, tokens);
if (player_input != "yes")
{
break;
}
}
std::cout << "\n";
std::cout << "Thanks for playing!\n";
std::cout << "\n";
system("pause");
return 0;
}