-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTowerOfMonsters.java
45 lines (35 loc) · 1.24 KB
/
TowerOfMonsters.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
public class TowerOfMonsters {
public static void main(String[] args) {
File inFile = null;
if (args.length > 0) {
inFile = new File(args[0]);
BufferedReader objReader = null;
try {
String line;
objReader = new BufferedReader(new FileReader(inFile));
while ((line = objReader.readLine()) != null) {
System.out.println(line);
Team team = MonsterParser.Parse(line);
//TODO: pass team of monsters to battle
System.out.println(team.getAliveMembersCount());
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (objReader != null) {
objReader.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
} else {
System.err.println("Invalid arguments count:" + args.length);
}
}
}