Last active
August 1, 2017 08:44
-
-
Save brudil/47aedccfef84816e13ad6e38bbb8d6d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createGeneration, gs, needsArticle, useArticle } from 'generation-game'; | |
const names = [ | |
'Dave', | |
'Chris', | |
'Sally', | |
'Lucy', | |
]; | |
const places = [ | |
'London', | |
needsArticle('Moon'), | |
'Brighton', | |
needsArticle('small shop left of Halfords'), | |
]; | |
const templates = [ | |
gs`I went to ${useArticle('the', places)} and it was wonderful`, // "I went to the Moon and it was wonderful" | |
gs`Beyond ${useArticle(places)} is a fella named ${names}`, | |
]; | |
const generator = createGeneration(templates); | |
console.log(generator.totalCombinations) // 32 | |
console.log(generator.generate()) // "Beyond a small shop left of Halfords is a fella named Dave" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment