-
Notifications
You must be signed in to change notification settings - Fork 461
Expand file tree
/
Copy pathChessConsole.java
More file actions
28 lines (23 loc) · 863 Bytes
/
ChessConsole.java
File metadata and controls
28 lines (23 loc) · 863 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
package chess;
import chess.view.InputView;
import chess.view.ResultView;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.List;
public class ChessConsole {
public static void main(String[] args) {
InputView inputView = new InputView();
ResultView resultView = new ResultView();
Board board = BoardFactory.makeBoard();
Deque<Team> deque = new ArrayDeque<>(List.of(Team.WHITE, Team.BLACK));
while (!board.isFinished()){
Team currentTeam = deque.poll();
resultView.showBoard(board);
resultView.showTeam(currentTeam);
List<Position> positions = inputView.readPosition();
board.move(positions.getFirst(), positions.getLast(), currentTeam);
deque.offer(currentTeam);
resultView.showBoard(board);
}
}
}