From 7625f015d597a6e025da1977f22727eccaf70fe6 Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Tue, 23 Sep 2014 15:32:38 -0700 Subject: [PATCH] Pull Word List into it's own file --- .../RandomAnswerGeneratorFromList.java | 382 +----------------- .../com/hangman/RandomNumberGenerator.java | 4 - src/main/java/com/hangman/WordList.java | 382 ++++++++++++++++++ 3 files changed, 384 insertions(+), 384 deletions(-) create mode 100644 src/main/java/com/hangman/WordList.java diff --git a/src/main/java/com/hangman/RandomAnswerGeneratorFromList.java b/src/main/java/com/hangman/RandomAnswerGeneratorFromList.java index a950ddf..f709894 100644 --- a/src/main/java/com/hangman/RandomAnswerGeneratorFromList.java +++ b/src/main/java/com/hangman/RandomAnswerGeneratorFromList.java @@ -3,384 +3,6 @@ public class RandomAnswerGeneratorFromList implements AnswerGenerator { private RandomNumberGenerator generator; - private static final String wordList[] = { - "aboard", - "accept", - "accident", - "accurate", - "acres", - "active", - "actual", - "additional", - "adjective", - "adult", - "adventure", - "advice", - "affect", - "Alice", - "alphabet", - "announced", - "anybody", - "apartment", - "applied", - "appropriate", - "April", - "arrange", - "arrangement", - "arrive", - "atom", - "attempt", - "August", - "Australia", - "Autumn", - "aware", - "badly", - "Bay", - "bee", - "behavior", - "belt", - "bend", - "bet", - "birth", - "bite", - "blind", - "border", - "bound", - "brass", - "breathe", - "breeze", - "brick", - "brief", - "buried", - "calm", - "camera", - "canal", - "captured", - "Casey", - "cast", - "castle", - "chamber", - "characteristic", - "chose", - "claws", - "coach", - "Columbus", - "command", - "compass", - "consonant", - "constantly", - "contrast", - "cookies", - "crack", - "curve", - "customs", - "damage", - "Daniel", - "Danny", - "David", - "dawn", - "declared", - "deeply", - "definition", - "depth", - "diameter", - "difficulty", - "dirty", - "discussion", - "dish", - "doll", - "Don", - "donkey", - "driven", - "dug", - "dull", - "duty", - "eager", - "earn", - "Eddy", - "Egypt", - "eleven", - "Ellen", - "engineer", - "equally", - "equator", - "essential", - "eventually", - "exchange", - "exist", - "explanation", - "explore", - "facing", - "fairly", - "fewer", - "fierce", - "fifth", - "film", - "finest", - "fireplace", - "firm", - "fix", - "flame", - "floating", - "Florida", - "folks", - "former", - "fort", - "forty", - "fox", - "Fred", - "frog", - "fully", - "garage", - "gasoline", - "gift", - "goose", - "grabbed", - "grade", - "grandmother", - "gravity", - "Greece", - "guard", - "gulf", - "habit", - "halfway", - "handsome", - "hang", - "happily", - "harbor", - "Harry", - "hay", - "he'll", - "headed", - "heading", - "hello", - "herd", - "hollow", - "horn", - "hospital", - "hunter", - "ill", - "Illinois", - "image", - "income", - "independent", - "industrial", - "instant", - "interior", - "introduced", - "January", - "Jeff", - "Johnson", - "Jones", - "judge", - "jungle", - "kids", - "label", - "labor", - "Lee", - "limited", - "location", - "loss", - "lucky", - "lungs", - "machinery", - "mad", - "magnet", - "mainly", - "managed", - "manufacturing", - "Maria", - "Mars", - "Martin", - "mathematics", - "melted", - "memory", - "mental", - "military", - "mill", - "mission", - "mistake", - "mixture", - "monkey", - "mood", - "Mount", - "movie", - "mysterious", - "nails", - "naturally", - "nearer", - "negative", - "neighborhood", - "nervous", - "Norway", - "noted", - "nuts", - "obtain", - "occasionally", - "October", - "officer", - "official", - "Ohio", - "opinion", - "opportunity", - "organization", - "origin", - "ourselves", - "owner", - "package", - "palace", - "pale", - "passage", - "Pennsylvania", - "percent", - "perfectly", - "Philadelphia", - "pilot", - "plastic", - "plates", - "pleasure", - "plural", - "plus", - "poet", - "poetry", - "Pole", - "policeman", - "porch", - "port", - "positive", - "possibly", - "pot", - "pour", - "powder", - "practical", - "previous", - "pride", - "primitive", - "principle", - "private", - "prize", - "promised", - "properly", - "protection", - "pupil", - "purple", - "raw", - "reader", - "rear", - "recall", - "refused", - "relationship", - "remarkable", - "remove", - "require", - "rhyme", - "roar", - "rocky", - "Rome", - "rubbed", - "rush", - "Russia", - "Russian", - "saddle", - "sale", - "salmon", - "satellites", - "satisfied", - "scared", - "screen", - "seldom", - "select", - "selection", - "settle", - "shake", - "shaking", - "shallow", - "shelf", - "shelter", - "shine", - "shout", - "silly", - "simplest", - "sink", - "slabs", - "slave", - "slight", - "slip", - "slope", - "soap", - "society", - "solar", - "somebody", - "somehow", - "species", - "specific", - "spider", - "spin", - "split", - "sport", - "stairs", - "stared", - "steep", - "stems", - "stiff", - "stock", - "stomach", - "stove", - "stranger", - "struggle", - "surrounded", - "swam", - "swept", - "swung", - "syllable", - "tales", - "tank", - "tape", - "thou", - "thumb", - "thy", - "tide", - "tightly", - "Tim", - "tobacco", - "torn", - "toy", - "trace", - "trap", - "treated", - "tribe", - "troops", - "tropical", - "trunk", - "tune", - "TV", - "typical", - "unhappy", - "universe", - "University", - "vapor", - "vertical", - "vessels", - "victory", - "visitor", - "vote", - "voyage", - "wealth", - "weigh", - "welcome", - "weren't", - "whistle", - "widely", - "Wilson", - "wolf", - "worried", - "wrapped", - "writer", - "younger", - "zero", - "zoo"}; - - public RandomAnswerGeneratorFromList(RandomNumberGenerator generator) { this.generator = generator; @@ -394,7 +16,7 @@ public RandomAnswerGeneratorFromList() @Override public String generateAnswer() { - int index = (int) (this.generator.Random() * (wordList.length - 1)); - return wordList[index]; + int index = (int) (this.generator.Random() * (WordList.words.length - 1)); + return WordList.words[index]; } } diff --git a/src/main/java/com/hangman/RandomNumberGenerator.java b/src/main/java/com/hangman/RandomNumberGenerator.java index 6c95203..f5c8fe8 100644 --- a/src/main/java/com/hangman/RandomNumberGenerator.java +++ b/src/main/java/com/hangman/RandomNumberGenerator.java @@ -1,9 +1,5 @@ package com.hangman; -/** - * Created by eric on 9/21/14. - */ public interface RandomNumberGenerator { - public double Random(); } diff --git a/src/main/java/com/hangman/WordList.java b/src/main/java/com/hangman/WordList.java new file mode 100644 index 0000000..74f6b11 --- /dev/null +++ b/src/main/java/com/hangman/WordList.java @@ -0,0 +1,382 @@ +package com.hangman; + +public class WordList { + + public static final String words[] = { + "aboard", + "accept", + "accident", + "accurate", + "acres", + "active", + "actual", + "additional", + "adjective", + "adult", + "adventure", + "advice", + "affect", + "Alice", + "alphabet", + "announced", + "anybody", + "apartment", + "applied", + "appropriate", + "April", + "arrange", + "arrangement", + "arrive", + "atom", + "attempt", + "August", + "Australia", + "Autumn", + "aware", + "badly", + "Bay", + "bee", + "behavior", + "belt", + "bend", + "bet", + "birth", + "bite", + "blind", + "border", + "bound", + "brass", + "breathe", + "breeze", + "brick", + "brief", + "buried", + "calm", + "camera", + "canal", + "captured", + "Casey", + "cast", + "castle", + "chamber", + "characteristic", + "chose", + "claws", + "coach", + "Columbus", + "command", + "compass", + "consonant", + "constantly", + "contrast", + "cookies", + "crack", + "curve", + "customs", + "damage", + "Daniel", + "Danny", + "David", + "dawn", + "declared", + "deeply", + "definition", + "depth", + "diameter", + "difficulty", + "dirty", + "discussion", + "dish", + "doll", + "Don", + "donkey", + "driven", + "dug", + "dull", + "duty", + "eager", + "earn", + "Eddy", + "Egypt", + "eleven", + "Ellen", + "engineer", + "equally", + "equator", + "essential", + "eventually", + "exchange", + "exist", + "explanation", + "explore", + "facing", + "fairly", + "fewer", + "fierce", + "fifth", + "film", + "finest", + "fireplace", + "firm", + "fix", + "flame", + "floating", + "Florida", + "folks", + "former", + "fort", + "forty", + "fox", + "Fred", + "frog", + "fully", + "garage", + "gasoline", + "gift", + "goose", + "grabbed", + "grade", + "grandmother", + "gravity", + "Greece", + "guard", + "gulf", + "habit", + "halfway", + "handsome", + "hang", + "happily", + "harbor", + "Harry", + "hay", + "he'll", + "headed", + "heading", + "hello", + "herd", + "hollow", + "horn", + "hospital", + "hunter", + "ill", + "Illinois", + "image", + "income", + "independent", + "industrial", + "instant", + "interior", + "introduced", + "January", + "Jeff", + "Johnson", + "Jones", + "judge", + "jungle", + "kids", + "label", + "labor", + "Lee", + "limited", + "location", + "loss", + "lucky", + "lungs", + "machinery", + "mad", + "magnet", + "mainly", + "managed", + "manufacturing", + "Maria", + "Mars", + "Martin", + "mathematics", + "melted", + "memory", + "mental", + "military", + "mill", + "mission", + "mistake", + "mixture", + "monkey", + "mood", + "Mount", + "movie", + "mysterious", + "nails", + "naturally", + "nearer", + "negative", + "neighborhood", + "nervous", + "Norway", + "noted", + "nuts", + "obtain", + "occasionally", + "October", + "officer", + "official", + "Ohio", + "opinion", + "opportunity", + "organization", + "origin", + "ourselves", + "owner", + "package", + "palace", + "pale", + "passage", + "Pennsylvania", + "percent", + "perfectly", + "Philadelphia", + "pilot", + "plastic", + "plates", + "pleasure", + "plural", + "plus", + "poet", + "poetry", + "Pole", + "policeman", + "porch", + "port", + "positive", + "possibly", + "pot", + "pour", + "powder", + "practical", + "previous", + "pride", + "primitive", + "principle", + "private", + "prize", + "promised", + "properly", + "protection", + "pupil", + "purple", + "raw", + "reader", + "rear", + "recall", + "refused", + "relationship", + "remarkable", + "remove", + "require", + "rhyme", + "roar", + "rocky", + "Rome", + "rubbed", + "rush", + "Russia", + "Russian", + "saddle", + "sale", + "salmon", + "satellites", + "satisfied", + "scared", + "screen", + "seldom", + "select", + "selection", + "settle", + "shake", + "shaking", + "shallow", + "shelf", + "shelter", + "shine", + "shout", + "silly", + "simplest", + "sink", + "slabs", + "slave", + "slight", + "slip", + "slope", + "soap", + "society", + "solar", + "somebody", + "somehow", + "species", + "specific", + "spider", + "spin", + "split", + "sport", + "stairs", + "stared", + "steep", + "stems", + "stiff", + "stock", + "stomach", + "stove", + "stranger", + "struggle", + "surrounded", + "swam", + "swept", + "swung", + "syllable", + "tales", + "tank", + "tape", + "thou", + "thumb", + "thy", + "tide", + "tightly", + "Tim", + "tobacco", + "torn", + "toy", + "trace", + "trap", + "treated", + "tribe", + "troops", + "tropical", + "trunk", + "tune", + "TV", + "typical", + "unhappy", + "universe", + "University", + "vapor", + "vertical", + "vessels", + "victory", + "visitor", + "vote", + "voyage", + "wealth", + "weigh", + "welcome", + "weren't", + "whistle", + "widely", + "Wilson", + "wolf", + "worried", + "wrapped", + "writer", + "younger", + "zero", + "zoo" + }; +}