-
Notifications
You must be signed in to change notification settings - Fork 1
/
insults.cpp
119 lines (106 loc) · 2.92 KB
/
insults.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
#include <cassert>
#include "insults.h"
Chooser::Chooser(std::initializer_list<const char*> choices)
{
for(const char *orig : choices)
gen_choices(orig, 0, "");
}
void Chooser::gen_choices(const std::string &orig, size_t index,
const std::string &prefix)
{
size_t pos = orig.find(' ', index);
if(pos == std::string::npos)
m_Choices.push_back(prefix + orig.substr(index));
else
{
gen_choices(orig, pos + 1,
prefix + orig.substr(index, pos - index) + ".");
gen_choices(orig, pos + 1,
prefix + orig.substr(index, pos - index) + "-");
}
}
const std::string &Chooser::operator()(Key &key) const
{
size_t p = key % m_Choices.size();
key /= m_Choices.size();
return m_Choices[p];
}
size_t Chooser::size() const
{
return m_Choices.size();
}
CombinedChoosers::CombinedChoosers(std::initializer_list<Chooser> choosers)
: m_Choosers(choosers)
{
}
std::string CombinedChoosers::operator()(Key key) const
{
std::string result;
for(const Chooser &ch : m_Choosers)
result += ch(key);
return result;
}
size_t CombinedChoosers::size() const
{
size_t choices = 1;
for(const Chooser &ch : m_Choosers)
choices *= ch.size();
return choices;
}
Insults::Insults()
: m_Choosers{
Chooser{"vas-y clique "},
Chooser{"salope",
"gros con",
"pauvre con",
"sale fils de pute",
"petite bite",
"fils de chienne",
"grosse merde",
"vieux chacal",
"sale encule",
"gros batard"},
Chooser{" ou "},
Chooser{"va trouer le cul de",
"va gifler",
"va defoncer l-anus de",
"va tuer",
"va crever",
"va cracher sur"},
Chooser{" "},
Chooser{"ta fille",
"ta grand mere",
"ton grand pere",
"ton chien",
"ta femme",
"ta chienne",
"ta soeur",
"ton frere"},
Chooser{" "},
Chooser{"au cimetiere",
"chez le coiffeur",
"dans ma cave",
"dans la cave",
"sous ma caisse",
"dans les champs",
"dans ton cul",
"dans la niche",
"a carrefour"},
Chooser{" "},
Chooser{"raclure de chiottes",
"face de pet",
"sous merde",
"sale batard",
"pauvre merde",
"fils de chien",
"grosse pute",
"sale enflure",
"petite catin"},
Chooser{" allez.clique-salope.ovh"}}
{
assert(m_Choosers.size() == CHOICES);
}
std::string Insults::generate(Key state)
{
return m_Choosers(state);
}