/
App.java
35 lines (31 loc) · 1.04 KB
/
App.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
import game.GameFactory;
import game.control.Control;
import game.inputconverter.InputConverter;
import game.messages.Messages;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* メインクラス
*/
public class App {
/**
* メインメソッド
* @param args 起動時の入力
* @throws IOException 入力例外
*/
public static void main(String[] args) throws IOException {
//GameFactory g = GameFactory.valueOf("TWOUP");
GameFactory g = GameFactory.valueOf("GUESS");
Messages messages = g.getMessages();
Control control = g.getControl();
InputConverter inputConverter = g.getInputConverter();
System.out.println(messages.welcome());
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while (control.moreTurns()) {
String input = reader.readLine().trim();
control.play(inputConverter.convert(input));
}
System.out.println(messages.done());
}
}