|
@@ -1,243 +0,0 @@
|
1
|
|
-/* @flow */
|
2
|
|
-
|
3
|
|
-import { randomElement } from '../base/util';
|
4
|
|
-
|
5
|
|
-/*
|
6
|
|
-const _NOUN_ = [
|
7
|
|
-];
|
8
|
|
-*/
|
9
|
|
-
|
10
|
|
-/**
|
11
|
|
- * The list of plural nouns.
|
12
|
|
- * @const
|
13
|
|
- */
|
14
|
|
-const _PLURALNOUN_ = [
|
15
|
|
- 'Aliens', 'Animals', 'Antelopes', 'Ants', 'Apes', 'Apples', 'Baboons',
|
16
|
|
- 'Bacteria', 'Badgers', 'Bananas', 'Bats', 'Bears', 'Birds', 'Bonobos',
|
17
|
|
- 'Brides', 'Bugs', 'Bulls', 'Butterflies', 'Cheetahs', 'Cherries', 'Chicken',
|
18
|
|
- 'Children', 'Chimps', 'Clowns', 'Cows', 'Creatures', 'Dinosaurs', 'Dogs',
|
19
|
|
- 'Dolphins', 'Donkeys', 'Dragons', 'Ducks', 'Dwarfs', 'Eagles', 'Elephants',
|
20
|
|
- 'Elves', 'Fathers', 'Fish', 'Flowers', 'Frogs', 'Fruit', 'Fungi',
|
21
|
|
- 'Galaxies', 'Geese', 'Goats', 'Gorillas', 'Hedgehogs', 'Hippos', 'Horses',
|
22
|
|
- 'Hunters', 'Insects', 'Kids', 'Knights', 'Lemons', 'Lemurs', 'Leopards',
|
23
|
|
- 'LifeForms', 'Lions', 'Lizards', 'Mice', 'Monkeys', 'Monsters', 'Mushrooms',
|
24
|
|
- 'Octopodes', 'Oranges', 'Orangutans', 'Organisms', 'Pants', 'Parrots',
|
25
|
|
- 'Penguins', 'People', 'Pigeons', 'Pigs', 'Pineapples', 'Plants', 'Potatoes',
|
26
|
|
- 'Priests', 'Rats', 'Reptiles', 'Reptilians', 'Rhinos', 'Seagulls', 'Sheep',
|
27
|
|
- 'Siblings', 'Snakes', 'Spaghetti', 'Spiders', 'Squid', 'Squirrels',
|
28
|
|
- 'Stars', 'Students', 'Teachers', 'Tigers', 'Tomatoes', 'Trees', 'Vampires',
|
29
|
|
- 'Vegetables', 'Viruses', 'Vulcans', 'Weasels', 'Werewolves', 'Whales',
|
30
|
|
- 'Witches', 'Wizards', 'Wolves', 'Workers', 'Worms', 'Zebras'
|
31
|
|
-];
|
32
|
|
-
|
33
|
|
-/*
|
34
|
|
-const _PLACE_ = [
|
35
|
|
- 'Pub', 'University', 'Airport', 'Library', 'Mall', 'Theater', 'Stadium',
|
36
|
|
- 'Office', 'Show', 'Gallows', 'Beach', 'Cemetery', 'Hospital', 'Reception',
|
37
|
|
- 'Restaurant', 'Bar', 'Church', 'House', 'School', 'Square', 'Village',
|
38
|
|
- 'Cinema', 'Movies', 'Party', 'Restroom', 'End', 'Jail', 'PostOffice',
|
39
|
|
- 'Station', 'Circus', 'Gates', 'Entrance', 'Bridge'
|
40
|
|
-];
|
41
|
|
-*/
|
42
|
|
-
|
43
|
|
-/**
|
44
|
|
- * The list of verbs.
|
45
|
|
- * @const
|
46
|
|
- */
|
47
|
|
-const _VERB_ = [
|
48
|
|
- 'Abandon', 'Adapt', 'Advertise', 'Answer', 'Anticipate', 'Appreciate',
|
49
|
|
- 'Approach', 'Argue', 'Ask', 'Bite', 'Blossom', 'Blush', 'Breathe', 'Breed',
|
50
|
|
- 'Bribe', 'Burn', 'Calculate', 'Clean', 'Code', 'Communicate', 'Compute',
|
51
|
|
- 'Confess', 'Confiscate', 'Conjugate', 'Conjure', 'Consume', 'Contemplate',
|
52
|
|
- 'Crawl', 'Dance', 'Delegate', 'Devour', 'Develop', 'Differ', 'Discuss',
|
53
|
|
- 'Dissolve', 'Drink', 'Eat', 'Elaborate', 'Emancipate', 'Estimate', 'Expire',
|
54
|
|
- 'Extinguish', 'Extract', 'Facilitate', 'Fall', 'Feed', 'Finish', 'Floss',
|
55
|
|
- 'Fly', 'Follow', 'Fragment', 'Freeze', 'Gather', 'Glow', 'Grow', 'Hex',
|
56
|
|
- 'Hide', 'Hug', 'Hurry', 'Improve', 'Intersect', 'Investigate', 'Jinx',
|
57
|
|
- 'Joke', 'Jubilate', 'Kiss', 'Laugh', 'Manage', 'Meet', 'Merge', 'Move',
|
58
|
|
- 'Object', 'Observe', 'Offer', 'Paint', 'Participate', 'Party', 'Perform',
|
59
|
|
- 'Plan', 'Pursue', 'Pierce', 'Play', 'Postpone', 'Pray', 'Proclaim',
|
60
|
|
- 'Question', 'Read', 'Reckon', 'Rejoice', 'Represent', 'Resize', 'Rhyme',
|
61
|
|
- 'Scream', 'Search', 'Select', 'Share', 'Shoot', 'Shout', 'Signal', 'Sing',
|
62
|
|
- 'Skate', 'Sleep', 'Smile', 'Smoke', 'Solve', 'Spell', 'Steer', 'Stink',
|
63
|
|
- 'Substitute', 'Swim', 'Taste', 'Teach', 'Terminate', 'Think', 'Type',
|
64
|
|
- 'Unite', 'Vanish', 'Worship'
|
65
|
|
-];
|
66
|
|
-
|
67
|
|
-/**
|
68
|
|
- * The list of adverbs.
|
69
|
|
- * @const
|
70
|
|
- */
|
71
|
|
-const _ADVERB_ = [
|
72
|
|
- 'Absently', 'Accurately', 'Accusingly', 'Adorably', 'AllTheTime', 'Alone',
|
73
|
|
- 'Always', 'Amazingly', 'Angrily', 'Anxiously', 'Anywhere', 'Appallingly',
|
74
|
|
- 'Apparently', 'Articulately', 'Astonishingly', 'Badly', 'Barely',
|
75
|
|
- 'Beautifully', 'Blindly', 'Bravely', 'Brightly', 'Briskly', 'Brutally',
|
76
|
|
- 'Calmly', 'Carefully', 'Casually', 'Cautiously', 'Cleverly', 'Constantly',
|
77
|
|
- 'Correctly', 'Crazily', 'Curiously', 'Cynically', 'Daily', 'Dangerously',
|
78
|
|
- 'Deliberately', 'Delicately', 'Desperately', 'Discreetly', 'Eagerly',
|
79
|
|
- 'Easily', 'Euphoricly', 'Evenly', 'Everywhere', 'Exactly', 'Expectantly',
|
80
|
|
- 'Extensively', 'Ferociously', 'Fiercely', 'Finely', 'Flatly', 'Frequently',
|
81
|
|
- 'Frighteningly', 'Gently', 'Gloriously', 'Grimly', 'Guiltily', 'Happily',
|
82
|
|
- 'Hard', 'Hastily', 'Heroically', 'High', 'Highly', 'Hourly', 'Humbly',
|
83
|
|
- 'Hysterically', 'Immensely', 'Impartially', 'Impolitely', 'Indifferently',
|
84
|
|
- 'Intensely', 'Jealously', 'Jovially', 'Kindly', 'Lazily', 'Lightly',
|
85
|
|
- 'Loudly', 'Lovingly', 'Loyally', 'Magnificently', 'Malevolently', 'Merrily',
|
86
|
|
- 'Mightily', 'Miserably', 'Mysteriously', 'NOT', 'Nervously', 'Nicely',
|
87
|
|
- 'Nowhere', 'Objectively', 'Obnoxiously', 'Obsessively', 'Obviously',
|
88
|
|
- 'Often', 'Painfully', 'Patiently', 'Playfully', 'Politely', 'Poorly',
|
89
|
|
- 'Precisely', 'Promptly', 'Quickly', 'Quietly', 'Randomly', 'Rapidly',
|
90
|
|
- 'Rarely', 'Recklessly', 'Regularly', 'Remorsefully', 'Responsibly',
|
91
|
|
- 'Rudely', 'Ruthlessly', 'Sadly', 'Scornfully', 'Seamlessly', 'Seldom',
|
92
|
|
- 'Selfishly', 'Seriously', 'Shakily', 'Sharply', 'Sideways', 'Silently',
|
93
|
|
- 'Sleepily', 'Slightly', 'Slowly', 'Slyly', 'Smoothly', 'Softly', 'Solemnly',
|
94
|
|
- 'Steadily', 'Sternly', 'Strangely', 'Strongly', 'Stunningly', 'Surely',
|
95
|
|
- 'Tenderly', 'Thoughtfully', 'Tightly', 'Uneasily', 'Vanishingly',
|
96
|
|
- 'Violently', 'Warmly', 'Weakly', 'Wearily', 'Weekly', 'Weirdly', 'Well',
|
97
|
|
- 'Well', 'Wickedly', 'Wildly', 'Wisely', 'Wonderfully', 'Yearly'
|
98
|
|
-];
|
99
|
|
-
|
100
|
|
-/**
|
101
|
|
- * The list of adjectives.
|
102
|
|
- * @const
|
103
|
|
- */
|
104
|
|
-const _ADJECTIVE_ = [
|
105
|
|
- 'Abominable', 'Accurate', 'Adorable', 'All', 'Alleged', 'Ancient', 'Angry',
|
106
|
|
- 'Anxious', 'Appalling', 'Apparent', 'Astonishing', 'Attractive', 'Awesome',
|
107
|
|
- 'Baby', 'Bad', 'Beautiful', 'Benign', 'Big', 'Bitter', 'Blind', 'Blue',
|
108
|
|
- 'Bold', 'Brave', 'Bright', 'Brisk', 'Calm', 'Camouflaged', 'Casual',
|
109
|
|
- 'Cautious', 'Choppy', 'Chosen', 'Clever', 'Cold', 'Cool', 'Crawly',
|
110
|
|
- 'Crazy', 'Creepy', 'Cruel', 'Curious', 'Cynical', 'Dangerous', 'Dark',
|
111
|
|
- 'Delicate', 'Desperate', 'Difficult', 'Discreet', 'Disguised', 'Dizzy',
|
112
|
|
- 'Dumb', 'Eager', 'Easy', 'Edgy', 'Electric', 'Elegant', 'Emancipated',
|
113
|
|
- 'Enormous', 'Euphoric', 'Evil', 'Fast', 'Ferocious', 'Fierce', 'Fine',
|
114
|
|
- 'Flawed', 'Flying', 'Foolish', 'Foxy', 'Freezing', 'Funny', 'Furious',
|
115
|
|
- 'Gentle', 'Glorious', 'Golden', 'Good', 'Green', 'Green', 'Guilty',
|
116
|
|
- 'Hairy', 'Happy', 'Hard', 'Hasty', 'Hazy', 'Heroic', 'Hostile', 'Hot',
|
117
|
|
- 'Humble', 'Humongous', 'Humorous', 'Hysterical', 'Idealistic', 'Ignorant',
|
118
|
|
- 'Immense', 'Impartial', 'Impolite', 'Indifferent', 'Infuriated',
|
119
|
|
- 'Insightful', 'Intense', 'Interesting', 'Intimidated', 'Intriguing',
|
120
|
|
- 'Jealous', 'Jolly', 'Jovial', 'Jumpy', 'Kind', 'Laughing', 'Lazy', 'Liquid',
|
121
|
|
- 'Lonely', 'Longing', 'Loud', 'Loving', 'Loyal', 'Macabre', 'Mad', 'Magical',
|
122
|
|
- 'Magnificent', 'Malevolent', 'Medieval', 'Memorable', 'Mere', 'Merry',
|
123
|
|
- 'Mighty', 'Mischievous', 'Miserable', 'Modified', 'Moody', 'Most',
|
124
|
|
- 'Mysterious', 'Mystical', 'Needy', 'Nervous', 'Nice', 'Objective',
|
125
|
|
- 'Obnoxious', 'Obsessive', 'Obvious', 'Opinionated', 'Orange', 'Painful',
|
126
|
|
- 'Passionate', 'Perfect', 'Pink', 'Playful', 'Poisonous', 'Polite', 'Poor',
|
127
|
|
- 'Popular', 'Powerful', 'Precise', 'Preserved', 'Pretty', 'Purple', 'Quick',
|
128
|
|
- 'Quiet', 'Random', 'Rapid', 'Rare', 'Real', 'Reassuring', 'Reckless', 'Red',
|
129
|
|
- 'Regular', 'Remorseful', 'Responsible', 'Rich', 'Rude', 'Ruthless', 'Sad',
|
130
|
|
- 'Scared', 'Scary', 'Scornful', 'Screaming', 'Selfish', 'Serious', 'Shady',
|
131
|
|
- 'Shaky', 'Sharp', 'Shiny', 'Shy', 'Simple', 'Sleepy', 'Slow', 'Sly',
|
132
|
|
- 'Small', 'Smart', 'Smelly', 'Smiling', 'Smooth', 'Smug', 'Sober', 'Soft',
|
133
|
|
- 'Solemn', 'Square', 'Square', 'Steady', 'Strange', 'Strong', 'Stunning',
|
134
|
|
- 'Subjective', 'Successful', 'Surly', 'Sweet', 'Tactful', 'Tense',
|
135
|
|
- 'Thoughtful', 'Tight', 'Tiny', 'Tolerant', 'Uneasy', 'Unique', 'Unseen',
|
136
|
|
- 'Warm', 'Weak', 'Weird', 'WellCooked', 'Wild', 'Wise', 'Witty', 'Wonderful',
|
137
|
|
- 'Worried', 'Yellow', 'Young', 'Zealous'
|
138
|
|
-];
|
139
|
|
-
|
140
|
|
-/*
|
141
|
|
-const _PRONOUN_ = [
|
142
|
|
-];
|
143
|
|
-*/
|
144
|
|
-
|
145
|
|
-/*
|
146
|
|
-const _CONJUNCTION_ = [
|
147
|
|
- 'And', 'Or', 'For', 'Above', 'Before', 'Against', 'Between'
|
148
|
|
-];
|
149
|
|
-*/
|
150
|
|
-
|
151
|
|
-/**
|
152
|
|
- * Maps a string (category name) to the array of words from that category.
|
153
|
|
- * @const
|
154
|
|
- */
|
155
|
|
-const CATEGORIES: { [key: string]: Array<string> } = {
|
156
|
|
- _ADJECTIVE_,
|
157
|
|
- _ADVERB_,
|
158
|
|
- _PLURALNOUN_,
|
159
|
|
- _VERB_
|
160
|
|
-
|
161
|
|
-// _CONJUNCTION_,
|
162
|
|
-// _NOUN_,
|
163
|
|
-// _PLACE_,
|
164
|
|
-// _PRONOUN_,
|
165
|
|
-};
|
166
|
|
-
|
167
|
|
-/**
|
168
|
|
- * The list of room name patterns.
|
169
|
|
- * @const
|
170
|
|
- */
|
171
|
|
-const PATTERNS = [
|
172
|
|
- '_ADJECTIVE__PLURALNOUN__VERB__ADVERB_'
|
173
|
|
-
|
174
|
|
- // BeautifulFungiOrSpaghetti
|
175
|
|
- // '_ADJECTIVE__PLURALNOUN__CONJUNCTION__PLURALNOUN_',
|
176
|
|
-
|
177
|
|
- // AmazinglyScaryToy
|
178
|
|
- // '_ADVERB__ADJECTIVE__NOUN_',
|
179
|
|
-
|
180
|
|
- // NeitherTrashNorRifle
|
181
|
|
- // 'Neither_NOUN_Nor_NOUN_',
|
182
|
|
- // 'Either_NOUN_Or_NOUN_',
|
183
|
|
-
|
184
|
|
- // EitherCopulateOrInvestigate
|
185
|
|
- // 'Either_VERB_Or_VERB_',
|
186
|
|
- // 'Neither_VERB_Nor_VERB_',
|
187
|
|
-
|
188
|
|
- // 'The_ADJECTIVE__ADJECTIVE__NOUN_',
|
189
|
|
- // 'The_ADVERB__ADJECTIVE__NOUN_',
|
190
|
|
- // 'The_ADVERB__ADJECTIVE__NOUN_s',
|
191
|
|
- // 'The_ADVERB__ADJECTIVE__PLURALNOUN__VERB_',
|
192
|
|
-
|
193
|
|
- // WolvesComputeBadly
|
194
|
|
- // '_PLURALNOUN__VERB__ADVERB_',
|
195
|
|
-
|
196
|
|
- // UniteFacilitateAndMerge
|
197
|
|
- // '_VERB__VERB_And_VERB_',
|
198
|
|
-
|
199
|
|
- // NastyWitchesAtThePub
|
200
|
|
- // '_ADJECTIVE__PLURALNOUN_AtThe_PLACE_',
|
201
|
|
-];
|
202
|
|
-
|
203
|
|
-/**
|
204
|
|
- * Generates a new room name.
|
205
|
|
- *
|
206
|
|
- * @returns {string} A newly-generated room name.
|
207
|
|
- */
|
208
|
|
-export function generateRoomWithoutSeparator() {
|
209
|
|
- // XXX Note that if more than one pattern is available, the choice of 'name'
|
210
|
|
- // won't have a uniform distribution amongst all patterns (names from
|
211
|
|
- // patterns with fewer options will have higher probability of being chosen
|
212
|
|
- // that names from patterns with more options).
|
213
|
|
- let name = randomElement(PATTERNS);
|
214
|
|
-
|
215
|
|
- while (_hasTemplate(name)) {
|
216
|
|
- for (const template in CATEGORIES) { // eslint-disable-line guard-for-in
|
217
|
|
- const word = randomElement(CATEGORIES[template]);
|
218
|
|
-
|
219
|
|
- name = name.replace(template, word);
|
220
|
|
- }
|
221
|
|
- }
|
222
|
|
-
|
223
|
|
- return name;
|
224
|
|
-}
|
225
|
|
-
|
226
|
|
-/**
|
227
|
|
- * Determines whether a specific string contains at least one of the
|
228
|
|
- * templates/categories.
|
229
|
|
- *
|
230
|
|
- * @param {string} s - String containing categories.
|
231
|
|
- * @private
|
232
|
|
- * @returns {boolean} True if the specified string contains at least one of the
|
233
|
|
- * templates/categories; otherwise, false.
|
234
|
|
- */
|
235
|
|
-function _hasTemplate(s) {
|
236
|
|
- for (const template in CATEGORIES) {
|
237
|
|
- if (s.indexOf(template) >= 0) {
|
238
|
|
- return true;
|
239
|
|
- }
|
240
|
|
- }
|
241
|
|
-
|
242
|
|
- return false;
|
243
|
|
-}
|