made riddler for rooms, etc...

This commit is contained in:
Luca Carnegie
2019-05-29 13:42:53 -04:00
parent 7c2e8f8df6
commit c50c63477c
9 changed files with 61 additions and 64 deletions

View File

@@ -16,8 +16,7 @@ import java.util.Scanner;
*/
class CommandWords {
// a constant array that holds all valid command words
private static HashMap<String, String> m_words = new HashMap<String, String>();
private static HashMap<String, String> m_synonyms = new HashMap<String, String>();
private static HashMap<String, String> m_words = new HashMap<String, String>();;
/**
* Constructor - initialise the command words.
*/
@@ -34,18 +33,6 @@ class CommandWords {
}catch (Exception e) {
e.printStackTrace();
}
try {
Scanner in = new Scanner(new File("data/synonyms.dat"));
while(in.hasNext()){
String text = in.nextLine();
String[] textarr = text.split(",");
m_synonyms.put(textarr[0], textarr[1].substring(1));
}
in.close();
}catch (Exception e) {
e.printStackTrace();
}
}
/**
@@ -95,16 +82,4 @@ class CommandWords {
}
System.out.println();
}
public static String replaceSynonym(String word) {
try {
String words = m_synonyms.get(word);
if(words == null)
throw new Exception();
else
return words;
} catch(Exception e) {
return word;
}
}
}