-
Notifications
You must be signed in to change notification settings - Fork 461
Expand file tree
/
Copy pathChessController.java
More file actions
37 lines (28 loc) · 1003 Bytes
/
ChessController.java
File metadata and controls
37 lines (28 loc) · 1003 Bytes
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
package chess.Controller;
import chess.domain.Board;
import chess.view.InputView;
import chess.view.OutputView;
import java.util.List;
public class ChessController {
private final InputView inputView;
private final OutputView outputView;
public ChessController(final InputView inputView, final OutputView outputView) {
this.inputView = inputView;
this.outputView = outputView;
}
public void run() {
Board board = new Board();
while (true) {
try {
outputView.printChessBoard(board);
outputView.printTurn(board.getTurn());
List<String> pieceInput = inputView.inputMovePiece();
List<String> positionInput = inputView.inputMovePosition();
board.movePiece(pieceInput, positionInput);
board.changeTurn();
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
}
}
}
}