-
Notifications
You must be signed in to change notification settings - Fork 0
/
quinns_wiz.cpp~
138 lines (135 loc) · 5.27 KB
/
quinns_wiz.cpp~
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// wizard based text game
// starts in an inn with wiz-boy
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int main(){
//initialize the gift given, and then set acceptable inputs
string gift;
string action;
char negative [4][9]={"no","No","nope","Nope"};
char positive [4][9]={"yes","Yes","yup","Yup"};
char ales [6][20]={"mug", "Mug", "ale","Ale","mug of ale", "Mug of ale"};
char heels [6][20]={"heel", "Heel", "bread","Bread","heel of bread","Heel of bread"};
char platter [12][50]={"platter", "Platter", "cheese","Cheese","onions","Onions","raw onions","Raw onions", "platter of raw onions", "Platter of raw onions", "platter of raw onions and cheese", "Platter of raw onions and cheese"};
//initial output and input
std::cout << "Due to the state of his robes, you can tell this wizard has fallen on hard times.\nWould you like to buy him a mug of ale, a heel of bread, or a platter of raw onions and cheese?" << '\n';
gift_input:
std::cin >> gift;
int compares = 2;
int count = 0;
string check;
while (compares!=0 && count<2) {
check = positive[count];
compares = gift.compare(check);
count = count + 1;
};
if (compares==0) {
std::cout <<"Well, what're you gonna buy him?"<< '\n';
goto gift_input;
};
compares = 2;
count = 0;
while (compares!=0 && count<4) {
check = negative[count];
compares = gift.compare(check);
count = count + 1;
};
if (compares==0) {
std::cout << "What're you gonna do instead?"<<"\n";
goto end_rude_wiz;
};
//compare gift to possible outputs
gift_check:
compares = 2;
count = 0;
while (compares!=0 && count<6) {
check = ales[count];
compares = gift.compare(check);
count = count + 1;
};
if (compares==0) {
std::cout << "The wizard, without hesitation, starts drinking the ale, and asks 'does this come with bread or perhaps a platter of onions and cheese?'" << '\n';
goto wiz_biz;
};
compares = 2;
count = 0;
while (compares!=0 && count<6) {
check = heels[count];
compares = gift.compare(check);
count = count + 1;
};
if (compares==0) {
std::cout << "The wizard, without hesitation, starts eating the bread, and asks 'does this come with ale or perhaps a platter of onions and cheese?'" << '\n';
goto wiz_biz;
};
compares = 2;
count = 0;
while (compares!=0 && count<12) {
check = platter[count];
compares = gift.compare(check);
count = count + 1;
};
if (compares==0) {
std::cout << "The wizard, without hesitation, starts eating the platter, and asks 'does this come with bread or perhaps a mug of ale?'" << '\n';
goto wiz_biz;
};
std::cout << "The bartender didn't understand your order. Try again:\n";
goto gift_input;
wiz_biz:
std:cin >> action;
compares = 2;
count = 0;
while (compares!=0 && count<4) {
check = negative[count];
compares = action.compare(check);
count = count + 1;
};
if (compares==0) {
std::cout << "You don't have to be a dick about it, man. Thanks for the " << gift << " anyways.\n";
std::cout << "The wizard goes back to his business being throughly down on his luck.\nWhat do you want to do now?\n";
goto end_rude_wiz;
};
compares = 2;
count = 0;
while (compares!=0 && count<2) {
check = positive[count];
compares = action.compare(check);
count = count + 1;
};
if (compares==0) {
std::cout << "Upon confirmation you were paying for his full meal, the wizard orders to the other two accompaniments"<<"\n";
std::cout << "He begins munching on bread, cheese, raw onions, and washing it down with a thorough helping of ale"<<"\n";
std::cout << "As he inhales all you've purchased for him, he begins to spin a tale of wizard-treasure"<<"\n";
std::cout << "'You might be wondering why I'm so raggedy' he spews out at you along with a raw onion" << "\n";
std::cout << "'I've spent the last eight months trying to find the sandals of seduction'" << "\n";
std::cout << "'Turns out, even if you do find them, you can't put them on without enchanted woolen socks'" << "\n";
std::cout << "'Now, I know you're wondering, why is it an issue for a wizard to get enchanted socks?'"<<"\n";
std::cout << "'Well I'm a wizard not an enchanter, and I'm so broke from the trip, I can't afford it." <<"\n";
std::cout << "'If you can get me a pair of enchanted woolen socks, I'll let you do a trial run of the sandals'"<<"\n";
std::cout << "You naturally accept his offer and can't wait to try those sandals out on some select peasants.\nWhat do you do first to try to get those enchanted socks?\n";
goto end_rude_wiz;
};
end_rude_wiz:
std::cin >> action;
action_check:
//list all possible recognized actions
char actions[13][20]={"look","Look","get","Get", "steal","Steal","go","Go","talk","Talk","search","Search","leave"};
//get first word of action given
string first_word_action = action.substr(0,action.find(' '));
//search actions to see if the action given is listed
compares = 2;
count = 0;
while (compares!=0 && count<13) {
check = actions[count];
compares = first_word_action.compare(check);
count = count + 1;
};
retry_loc_1:
if (!compares==0) {
std::cout << "You can't do that here. Try again:" << "\n";
goto end_rude_wiz;
};
std::cout << "End of file, need to write more\n";
};