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