|
|
@ -21,11 +21,7 @@ public class Chess extends Game { |
|
|
|
} |
|
|
|
|
|
|
|
private void init() { |
|
|
|
chessBoard = new ChessBoard(); |
|
|
|
currentTeam = ChessFigure.Team.WHITE; |
|
|
|
destroyedWhiteFigures = new ArrayList<>(); |
|
|
|
destroyedBlackFigures = new ArrayList<>(); |
|
|
|
outputBuffer.addAll(chessBoard.getOutputBoard()); |
|
|
|
resetGame(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -33,6 +29,19 @@ public class Chess extends Game { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private ArrayList<String> getHeader() { |
|
|
|
ArrayList<String> header = new ArrayList<>(); |
|
|
|
|
|
|
|
header.add("Welcome to the good old game Chess!"); |
|
|
|
header.add("First select one cell like: 'e7', than confirm it with an enter."); |
|
|
|
header.add("After that, select a second cell and also confirm it with an enter."); |
|
|
|
header.add("The Goal is to defeat the other teams King(K)."); |
|
|
|
header.add(""); |
|
|
|
header.add("It's your Turn " + currentTeam.name().toLowerCase() + "."); |
|
|
|
|
|
|
|
return header; |
|
|
|
} |
|
|
|
|
|
|
|
//int[0] = x, int[1] = y; |
|
|
|
public int[] convertInput(String input) { |
|
|
|
int[] temp = new int[2]; |
|
|
@ -149,6 +158,16 @@ public class Chess extends Game { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public void resetGame() { |
|
|
|
chessBoard = new ChessBoard(); |
|
|
|
currentTeam = ChessFigure.Team.WHITE; |
|
|
|
destroyedWhiteFigures = new ArrayList<>(); |
|
|
|
destroyedBlackFigures = new ArrayList<>(); |
|
|
|
outputBuffer.clear(); |
|
|
|
outputBuffer.addAll(getHeader()); |
|
|
|
outputBuffer.addAll(chessBoard.getOutputBoard()); |
|
|
|
} |
|
|
|
|
|
|
|
public ChessBoard getChessBoard() { |
|
|
|
return this.chessBoard; |
|
|
|
} |
|
|
|