Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

RoomnameGenerator.js 9.6KB

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