Skip to content

Instantly share code, notes, and snippets.

@beyond-code-github
Last active February 5, 2018 09:14
Show Gist options
  • Save beyond-code-github/b4c1477aba94cdc67f5ccc86deeb6351 to your computer and use it in GitHub Desktop.
Save beyond-code-github/b4c1477aba94cdc67f5ccc86deeb6351 to your computer and use it in GitHub Desktop.
Pub name generator, simply wire in a function r that provides a random number (min, max) =>
"The King's Arms"
"The Three Dragons"
"The Wise Old Star"
"The George's Retreat"
"The Rising George"
"The Trout's Tavern"
"The Four Moons"
"The Bird's Arms"
"The Great Cross"
"The Angry Lion"
"The Wrinkly Key"
"The Rising Sun"
"The George"
"The Hare's Lodge"
"The Black Hound"
"The Cross Fox"
"The Black Key"
"The Rising Anchor"
"The King"
"The Three Ships"
"The Bird's Lodge"
"The Lion's Lodge"
"The Four Masons"
"The Two Keys"
"The Moon"
"The Weary Dog"
"The Blue Hound"
"The Barmy Duck"
"The Fisherman's Rest"
"The Angel's Head"
"The Star and Falcon"
"The Dragon and Star"
"The Mason's Tavern"
"The Hart and Horses"
"The Weary Fox"
"The Fox and Crosses"
"The Angel's Lodge"
"The Angry Duck"
"The Stoat and Crowns"
"The Black Bird"
"The Wrinkly Hare"
"The George's Arms"
"The Weary Moon"
"The Great Nag"
"The Windmill and Trout"
"The Four Lambs"
"The Three Stars"
"The Star"
"The Horse"
"The Thirsty Lamb"
"The Royal King"
"The Windmill"
"The Trout's Rest"
"The Bull and Duke"
"The Key"
"The Rising Magpie"
"The Golden Magpie"
"The Wise Old Duck"
"The Great Cross"
"The Stoat's Arms"
"The Cross"
"The Hare and Duck"
"The Rising Duke"
"The Bird"
"The Four Anchors"
"The Weary Fox"
"The Duck's Tavern"
"The Windmill and Cross"
"The Magpie and Dragon"
"The Magpie's Tavern"
"The Windmill and Crown"
"The Dog's Retreat"
"The Bear"
"The Two Dogs"
"The Falcon"
"The Queen"
"The Frog's Arms"
"The Trout's Arms"
"The Lion"
"The Lion's Retreat"
"The Great Lion"
"The Two Magpies"
"The Lamb and Dogs"
"The Oak and Fishermans"
"The Three Birds"
"The Black Rose"
"The Fox's Tavern"
"The Barmy Bird"
"The Horse"
"The Fox and Hound"
"The Queen's Rest"
"The Trout's Tavern"
"The George's Retreat"
"The Oak and Bird"
"The Weary Swan"
"The Dragon's Head"
"The Nag and Anchors"
"The Queen and Magpie"
"The Thirsty Duck"
"The Rising Anchor"
"The Golden Trout"
"The Royal Hart"
"The Sun"
"The Fox and Dragon"
"The Four Crosses"
"The Sheep's Arms"
"The Great Mason"
"The Mason and Cricketers"
"The Royal Magpie"
"The Duck's Head"
"The Five Anchors"
"The Stoat"
"The Key and Anchors"
"The Swan's Retreat"
"The Rose"
"The Dragon and Harts"
"The Two Anchors"
"The Dragon and Cricketers"
"The Bear and Star"
"The Red Dog"
"The Swan's Retreat"
"The Sheep's Arms"
"The Great Nag"
"The Blue Windmill"
"The Golden Hound"
"The George's Lodge"
"The Rising George"
"The Rising Horse"
"The George"
"The Windmill"
"The Weary Star"
"The Trout and Badger"
"The George"
"The Three Stoats"
"The Cricketer"
"The Great Bull"
"The King"
"The Two Masons"
"The Trout and Sun"
"The Magpie's Lodge"
"The Moon"
"The Barmy Duke"
"The Moon and Star"
"The Mason's Retreat"
"The Moon and George"
"The Duke's Retreat"
"The Hare's Retreat"
"The Sheep and Swan"
"The Duke and Cross"
"The Crown and Hares"
"The Wrinkly Sun"
"The King"
"The Cross Dragon"
"The Lamb's Head"
"The Blue Dog"
"The Angry Duke"
"The Stoat"
"The Key and Bulls"
"The Dragon and Falcon"
"The Hare's Tavern"
"The Wise Old Sheep"
"The Nag"
"The Sheep's Tavern"
"The Bear's Lodge"
"The Dragon's Arms"
"The Swan and Ship"
"The Falcon's Retreat"
"The Swan's Tavern"
"The Swan and Trouts"
"The Fox and Sheep"
"The Horse and Harts"
"The Dragon's Head"
"The Sheep's Head"
"The Rising Lamb"
"The Hound's Retreat"
"The Fisherman and Hare"
"The Mason's Retreat"
"The Blue Oak"
"The Trout and Crown"
"The King's Retreat"
"The Cricketer's Tavern"
"The Red Stoat"
"The Swan"
"The Crown"
"The Cross Trout"
"The Rising Mason"
"The Angel and Stars"
"The Two Swans"
"The Dog and Cross"
"The Angry Angel"
"The Black Falcon"
"The Rising Stoat"
"The Cricketer and Stoat"
"The Fisherman and Bears"
"The Blue Fox"
"The Fisherman and Lambs"
"The Stoat"
"The Fox and Stoats"
"The White Frog"
"The Royal Lion"
const generate = (r) => {
// The <something>
// The <person/animal> <posession>
// The <adjective> <something>
// The <something> and <something><s>
const type = r(0,9);
switch (type) {
case 0:
return `The ${oneOf(r, things.map(([x]) => x))}`;
case 1:
case 2:
return `The ${oneOf(r, personAnimals.map(([x]) => x))}'s ${oneOf(r, possessions)}`;
case 3:
case 4:
case 5:
if (r(0, adjectives.length + numbers.length - 1) > adjectives.length - 1) {
return `The ${oneOf(r, numbers)} ${oneOf(r, plurals)}`;
}
else
{
return `The ${oneOf(r, adjectives)} ${oneOf(r, somethings)}`;
}
case 6:
case 7:
case 8:
case 9:
return `The ${oneOf(r, somethings)} and ${oneOf(r, somethingsAndPlurals)}`;
}
}
function oneOf(r, list) {
return list[r(0, list.length - 1)];
}
const things = [
["Hart", "s"],
["Crown", "s"],
["Oak", "s"],
["Rose", "s"],
["Sun", "s"],
["Moon", "s"],
["Star", "s"],
["Windmill", "s"],
["Anchor", "s"],
["Ship", "s"],
["Key", "s"],
["Bell", "s"],
["Horseshoe", "s"],
["Wheatsheaf", "s"],
["Plough", "s"],
["Hand", "s"],
["Flower", "s"]
];
const personAnimals = [
["Lion", "s"],
["Swan", "s"],
["Bear", "s"],
["Lamb", "s"],
["Bull", "s"],
["Dog", "s"],
["Fox", "es"],
["Sheep", ""],
["Horse", "s"],
["Dragon", "s"],
["George", ""],
["King", "s"],
["Queen", "s"],
["Duke", "s"],
["Magpie", "s"],
["Stoat", "s"],
["Hound", "s"],
["Mason", "s"],
["Nag", "s"],
["Cricketer", "s"],
["Bird", "s"],
["Angel", "s"],
["Hare", "s"],
["Duck", "s"],
["Frog", "s"],
["Falcon", "s"],
["Trout", ""],
["Fisherman", "s"],
["Badger", "s"],
["Ferret", "s"],
["Crow", "s"],
["Shrew", "s"],
["Kingfisher", "s"],
["Hedgehog", "s"],
["Squirrel", "s"],
["Newt", "s"],
];
const somethings = [...things.map(([x]) => x), ...personAnimals.map(([x]) => x)];
const plurals = [...things.map(([x, y]) => `${x}${y}`), ...personAnimals.map(([x, y]) => `${x}${y}`)];
const somethingsAndPlurals = [
...things.map(([x]) => x),
...things.map(([x]) => x), // things are here twice just to up the chances of them appearing relative to all the plurals
...things.map(([x, y]) => `${x}${y}`),
...personAnimals.map(([x]) => x),
...personAnimals.map(([x, y]) => `${x}${y}`)];
const possessions = [
"Arms",
"Head",
"Tavern",
"Rest",
"Retreat",
"Lodge",
"Inn",
"Castle"
];
const adjectives = [
"White",
"Red",
"Blue",
"Black",
"Weary",
"Thirsty",
"Great",
"Royal",
"Rising",
"Golden",
"Angry",
"Barmy",
"Wise Old",
"Wrinkly",
"Sneaky",
"Exigent",
"Cantankerous",
"Crumpled",
"Lazy",
"Fallen",
];
const numbers = [
"Two",
"Three",
"Four",
"Five",
"Six",
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment