- commit
- 4c8743574b19679f2b06b5da74e25ecb397ac528
- parent
- 80c7d2b963abb6d951f0bdf3748bd0b0f92d96f9
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-12-17 18:03
more words
Diffstat
M | words.js | 11 | ++++++++++- |
1 files changed, 10 insertions, 1 deletions
diff --git a/words.js b/words.js
@@ -2,7 +2,16 @@ import * as utils from './utils.js'; 2 2 3 3 var animals = ['ant', 'bird', 'cat', 'chicken', 'cow', 'dog', 'elephant', 'fish', 'fox', 'horse', 'kangaroo', 'lion', 'monkey', 'penguin', 'pig', 'rabbit', 'sheep', 'tiger', 'whale', 'wolf']; 4 4 var adjectives = ['affectionate', 'agreeable', 'amiable', 'bright', 'charming', 'creative', 'determined', 'energetic', 'friendly', 'funny', 'generous', 'imaginative', 'polite', 'likable', 'gregarious', 'diplomatic', 'sincere', 'helpful', 'giving', 'kind', 'hardworking', 'diligent', 'patient', 'dynamic', 'loyal']; -1 5 var onomatopoeia = ['chomp', 'cough', 'gargle', 'gibberish', 'hiccup', 'hum', 'whisper', 'bang', 'boom', 'splash', 'whoosh', 'beep', 'zap', 'roar', 'meow', 'pew pew']; -1 6 var concepts = ['adventure', 'annoyance', 'artistry', 'childhood', 'comfort', 'communication', 'confusion', 'delight', 'disbelief', 'elegance', 'friendship', 'horror', 'kindness', 'luxury', 'pleasure', 'rhythm', 'sensitivity', 'silliness', 'speed', 'truth', 'uncertainty', 'union']; 5 7 6 8 export var randomWord = function() {7 -1 return utils.randomChoice(adjectives) + ' ' + utils.randomChoice(animals);-1 9 var r = Math.random(); -1 10 if (r < 0.4) { -1 11 return utils.randomChoice(adjectives) + ' ' + utils.randomChoice(animals); -1 12 } else if (r < 0.7) { -1 13 return utils.randomChoice(onomatopoeia); -1 14 } else { -1 15 return utils.randomChoice(concepts); -1 16 } 8 17 };