forked from bigardone/phoenix-battleship
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:bigardone/phoenix-battleship
- Loading branch information
Showing
8 changed files
with
347 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,317 @@ | ||
defmodule Battleship.Pirate do | ||
@moduledoc """ | ||
Pirate stuff | ||
""" | ||
|
||
@pirate_words [ | ||
"ahoy", | ||
"matey", | ||
|
||
# Source: https://github.com/mikewesthad/pirate-speak/blob/master/lib/pirate-speak.js | ||
"helm", | ||
"grog", | ||
"vast", | ||
"coin", | ||
"coins", | ||
"admiral", | ||
"rum", | ||
"barrel", | ||
"lad", | ||
"mate", | ||
"parrot", | ||
"hornswaggle", | ||
"hails", | ||
"shipshape", | ||
"shanty", | ||
"keelhaul", | ||
"doubloon", | ||
"crew", | ||
"eyepatch", | ||
"debt", | ||
"wench", | ||
"wenches", | ||
"grub", | ||
"shipmate", | ||
"sail", | ||
"maties", | ||
"bluderbuss", | ||
"hook", | ||
"yoho", | ||
"yohoho", | ||
"yohohoho", | ||
"fleebag", | ||
"sunk", | ||
"isle", | ||
"brig", | ||
"lasses", | ||
"lass", | ||
"blimey", | ||
"parchment", | ||
"scallywags", | ||
"starboard", | ||
"cargo", | ||
"yarr", | ||
"puny", | ||
"swoggler", | ||
"booty", | ||
"beauties", | ||
"duty", | ||
"aye", | ||
"ye", | ||
"yer", | ||
|
||
# Source: https://gist.github.com/devlaers/1308006#file-pirate_phrases-txt | ||
"yo-ho-ho", | ||
"ahoy", | ||
"avast", | ||
"arrr", | ||
"blaggart", | ||
"foul", | ||
"whar", | ||
"comely", | ||
"broadside", | ||
"fleabag", | ||
"skull", | ||
"scuppers", | ||
"buried", | ||
"treasure", | ||
] | ||
|
||
@pirate_names [ | ||
# Source: https://en.wikipedia.org/wiki/List_of_fictional_pirates | ||
"Portgas D. Ace", | ||
"Captain Jesamiah Acorne", | ||
"Morgan Adams", | ||
"Johannes Alberic", | ||
"Captain Anton", | ||
"Atomsk", | ||
"Jean Benoit Aubery", | ||
"Captain Henry Avery", | ||
"Tom Ayrton", | ||
"Seth Balmore", | ||
"Balthier", | ||
"Hector Barbossa", | ||
"Captain Barrett", | ||
"Belit", | ||
"Ben Ali", | ||
"Biere Du Boucanier", | ||
"Bikke", | ||
"Black Bellamy", | ||
"Captain Bizzarly", | ||
"The Black Corsair", | ||
"Black John Licorice", | ||
"The Black Pirate", | ||
"Black Vulmea", | ||
"Roger Blease", | ||
"Captain Blood", | ||
"Bloody Bill", | ||
"Captain Bloth", | ||
"Billy Bones", | ||
"Bras Prique", | ||
"Tom Bristol", | ||
"Captain Broom", | ||
"Douglas Dawg Brown", | ||
"Paul Burchill", | ||
"Cannonball", | ||
"Captain Gavin Capacitor", | ||
"Captain Carryall", | ||
"Captain Carlton", | ||
"Capn Crunch", | ||
"Captain Claw", | ||
"Captain Clegg", | ||
"Captain Firebrand", | ||
"Captain Skunkbeard", | ||
"Conan the Barbarian", | ||
"John Connor", | ||
"Captain Corroboc", | ||
"Cortez", | ||
"Conrad", | ||
"Cuthbert Conyers", | ||
"Henriette Cooper", | ||
"Captain Henry Crow", | ||
"Jack Crow", | ||
"Captain Jack Dancer", | ||
"Arabella Drummond", | ||
"Ragnar Danneskjoeld", | ||
"Captain Angstrom Darkwater", | ||
"Charlotte de Berry", | ||
"DeFlorres", | ||
"Cervantes de Leon", | ||
"Willem van der Decken", | ||
"Edward Kenway", | ||
"Elisabet Ramsey", | ||
"Emperor Grog", | ||
"Captain Feathersword", | ||
"The Fishhawk", | ||
"Patty Fleur", | ||
"Captain Flint", | ||
"The Flying Dutchman", | ||
"Foxy the Pirate", | ||
"Jose Gaspar", | ||
"Gilbert", | ||
"Gunpowder Gertie", | ||
"Guinea Pirate", | ||
"Captain Gutt", | ||
"Gokaigers", | ||
"Gol D. Roger", | ||
"Guybrush Threepwood", | ||
"Gangplank", | ||
"Captain Harlock", | ||
"Bob Harvey", | ||
"Dutch Hodgers", | ||
"Captain James Hook", | ||
"Captain Charles Hunter", | ||
"Captain Ironhook", | ||
"Captain Isabela", | ||
"B. Jenet", | ||
"Jezebel Jack", | ||
"Jonathan Jones", | ||
"Don Karnage", | ||
"Kongre", | ||
"Korsars", | ||
"King of the Atlantic", | ||
"Captain Arthur Kirkland", | ||
"Drongo Kane", | ||
"Ker Karraje", | ||
"Maquesta Kar-Thon", | ||
"Captain Kennit", | ||
"Chung Khan", | ||
"Nancy Kington", | ||
"Denise Lafitte", | ||
"Johnny LaFitte", | ||
"Locke Lamora", | ||
"Trafalgar Law", | ||
"John Milton", | ||
"LeChuck", | ||
"Missee Lee", | ||
"Captain LeFwee", | ||
"Captain Levasseur", | ||
"Captain Red Ned Lynch", | ||
"Monkey D. Luffy", | ||
"James Durie", | ||
"Mad Jack the Pirate", | ||
"Malgo", | ||
"Jean Malot", | ||
"Morgan Moonscar McWright", | ||
"McGrath", | ||
"John Merrick", | ||
"MooBeard", | ||
"Mulligan", | ||
"Murdoch Juan", | ||
"Marquise Spinneret Mindfang", | ||
"Manjanungo", | ||
"Elaine Marley", | ||
"Bosun Moon", | ||
"Captain Morgan", | ||
"Andrew Murray", | ||
"Captain Mutiny", | ||
"Harry Markel", | ||
"Captain Marika Kato", | ||
"Nabel", | ||
"Carson Napier", | ||
"Captain Nemo", | ||
"Wolf ODonnell", | ||
"One-Eyed Jane", | ||
"One-Eared Pirate", | ||
"One-Eyed Willy", | ||
"Orm the Red", | ||
"Painty the Pirate", | ||
"Sneaky Pete", | ||
"Pirate Pimm", | ||
"Pirate Beard", | ||
"The Pirate Captain", | ||
"Piet Piraat", | ||
"Captain Pugwash", | ||
"Quartermaster", | ||
"Ragnar Danneskjoeld", | ||
"Sir Raleigh", | ||
"Red Rodney Radcliffe", | ||
"Red Rackham", | ||
"Red Sonja", | ||
"Redbeard", | ||
"Risky Boots", | ||
"Ridley", | ||
"Roan Tom", | ||
"Robert the Terrible", | ||
"Jonathan Rockhal", | ||
"Captain Roger", | ||
"Kaptain K. Rool", | ||
"Russell", | ||
"Rusty Pete", | ||
"Sailor John", | ||
"Captain Stingaree", | ||
"Captain Samuel Salt", | ||
"Captain Shakespeare", | ||
"Captain John Sharkey", | ||
"Captain Sabertooth", | ||
"Sandokan", | ||
"Captain Scarblade", | ||
"Faris Scherwiz", | ||
"Captain Scratch", | ||
"Sea Hawk", | ||
"Searats", | ||
"Sed", | ||
"Minerva Sharpe", | ||
"Sir Arthur Richards of Kent", | ||
"Sissy Le Poop", | ||
"Smelly Pete", | ||
"Shark Bait", | ||
"Captain Skunkbeard", | ||
"Long Joan Silver", | ||
"Long John Silver", | ||
"Kaptain Skurvy", | ||
"Captain Romulus Slag", | ||
"Solomon", | ||
"Steve the Pirate", | ||
"Stickybeard", | ||
"Syndicate of Pirates", | ||
"Captain Syrup", | ||
"Vikram Szpirglas", | ||
"Captain Spade", | ||
"Henry Steel", | ||
"Captain Jack Sparrow", | ||
"Captain Ishmael Squint", | ||
"Elizabeth Swann", | ||
"Taicoon Chang", | ||
"Taicoon Wu", | ||
"Jean Tannen", | ||
"Captain Teague", | ||
"Captain Tempest", | ||
"Tetra", | ||
"Theseus", | ||
"Thoas", | ||
"Abraham Tuizentfloot", | ||
"Gammis Turek", | ||
"William Turner", | ||
"Guybrush Threepwood", | ||
"Captain Vasquez", | ||
"Heinrich Von Marzipan", | ||
"Vyse", | ||
"Jamie Waring", | ||
"Duchy of Waldegren", | ||
"Captain Whisker", | ||
"Yanez de Gomera", | ||
"Yellowbeard", | ||
"Zack", | ||
"Zanzibar", | ||
] | ||
|
||
@doc """ | ||
Generates a id like "ahoy-matey-4523" | ||
""" | ||
def generate_id(amount_words, number_max) when amount_words >= 1 and number_max >= 100 do | ||
words = @pirate_words |> Enum.shuffle |> Enum.take(amount_words) | ||
[random_number] = Enum.take_random(100..number_max, 1) | ||
Enum.join(words, "-") <> "-" <> to_string(random_number) | ||
end | ||
|
||
@doc """ | ||
Generates a name like "Smelly Pete 8255" | ||
""" | ||
def generate_player_name(number_max) when number_max >= 100 do | ||
[name] = @pirate_names |> Enum.shuffle |> Enum.take(1) | ||
[random_number] = Enum.take_random(100..number_max, 1) | ||
name <> " " <> to_string(random_number) | ||
end | ||
|
||
end |
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
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
Oops, something went wrong.