|
@ -21,11 +21,7 @@ public class Chess extends Game { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void init() { |
|
|
private void init() { |
|
|
chessBoard = new ChessBoard(); |
|
|
|
|
|
currentTeam = ChessFigure.Team.WHITE; |
|
|
|
|
|
destroyedWhiteFigures = new ArrayList<>(); |
|
|
|
|
|
destroyedBlackFigures = new ArrayList<>(); |
|
|
|
|
|
outputBuffer.addAll(chessBoard.getOutputBoard()); |
|
|
|
|
|
|
|
|
resetGame(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@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; |
|
|
//int[0] = x, int[1] = y; |
|
|
public int[] convertInput(String input) { |
|
|
public int[] convertInput(String input) { |
|
|
int[] temp = new int[2]; |
|
|
int[] temp = new int[2]; |
|
@ -149,6 +158,17 @@ public class Chess extends Game { |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void resetGame() { |
|
|
|
|
|
chessBoard = new ChessBoard(); |
|
|
|
|
|
firstTurn = null; |
|
|
|
|
|
currentTeam = ChessFigure.Team.WHITE; |
|
|
|
|
|
destroyedWhiteFigures = new ArrayList<>(); |
|
|
|
|
|
destroyedBlackFigures = new ArrayList<>(); |
|
|
|
|
|
outputBuffer.clear(); |
|
|
|
|
|
outputBuffer.addAll(getHeader()); |
|
|
|
|
|
outputBuffer.addAll(chessBoard.getOutputBoard()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public ChessBoard getChessBoard() { |
|
|
public ChessBoard getChessBoard() { |
|
|
return this.chessBoard; |
|
|
return this.chessBoard; |
|
|
} |
|
|
} |
|
|