master
This commit is contained in:
parent
e0fe33889c
commit
5976144673
@ -97,6 +97,25 @@ public class HangMan {
|
||||
|
||||
}
|
||||
|
||||
public String[] loadList(String filePath) {
|
||||
String[] wordList;
|
||||
try {
|
||||
BufferedReader bf = new BufferedReader(new FileReader(filePath));
|
||||
ArrayList < String > al = new ArrayList < String > ();
|
||||
while (bf.ready()) {
|
||||
String[] c = bf.readLine().split(";");
|
||||
al.add(c[0]);
|
||||
}
|
||||
wordList = al.stream().toArray(String[]::new);
|
||||
System.out.println("[Dictionary loaded with " + wordList.length + " words]");
|
||||
bf.close();
|
||||
return wordList;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
HangMan hang = new HangMan();
|
||||
while (true) {
|
||||
|
Reference in New Issue
Block a user