fix build
This commit is contained in:
@@ -6,11 +6,11 @@ import chess.controller.OutputSystem;
|
|||||||
import chess.controller.commands.GetPieceAtCommand;
|
import chess.controller.commands.GetPieceAtCommand;
|
||||||
import chess.controller.commands.MoveCommand;
|
import chess.controller.commands.MoveCommand;
|
||||||
import chess.controller.commands.PromoteCommand;
|
import chess.controller.commands.PromoteCommand;
|
||||||
|
import chess.controller.commands.SurrenderCommand;
|
||||||
import chess.model.Color;
|
import chess.model.Color;
|
||||||
import chess.model.Coordinate;
|
import chess.model.Coordinate;
|
||||||
import chess.model.Move;
|
import chess.model.Move;
|
||||||
import chess.model.Piece;
|
import chess.model.Piece;
|
||||||
import chess.model.pieces.*;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
@@ -46,12 +46,17 @@ public class Console implements OutputSystem {
|
|||||||
Coordinate start = stringToCoordinate(scanner.nextLine());
|
Coordinate start = stringToCoordinate(scanner.nextLine());
|
||||||
System.out.println("New position: ");
|
System.out.println("New position: ");
|
||||||
Coordinate end = stringToCoordinate(scanner.nextLine());
|
Coordinate end = stringToCoordinate(scanner.nextLine());
|
||||||
return (this.commandExecutor.executeCommand(new MoveCommand(new Move(start, end))) == Command.CommandResult.Moved;
|
return this.commandExecutor.executeCommand(new MoveCommand(new Move(start, end))) == Command.CommandResult.Moved;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean playerPickedSurrender(Color player) {
|
||||||
|
this.commandExecutor.executeCommand(new SurrenderCommand(player));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playerTurn(Color color) {
|
public void playerTurn(Color color) {
|
||||||
|
updateDisplay();
|
||||||
System.out.println(Colors.RED + "Player turn: " + color + Colors.RESET);
|
System.out.println(Colors.RED + "Player turn: " + color + Colors.RESET);
|
||||||
boolean endTurn = false;
|
boolean endTurn = false;
|
||||||
do {
|
do {
|
||||||
@@ -64,7 +69,7 @@ public class Console implements OutputSystem {
|
|||||||
endTurn = switch (scanner.nextLine()) {
|
endTurn = switch (scanner.nextLine()) {
|
||||||
case "1" -> playerPickedMove();
|
case "1" -> playerPickedMove();
|
||||||
case "2" -> playerPickedShowMoves();
|
case "2" -> playerPickedShowMoves();
|
||||||
case "3" -> playerPickedSurrender();
|
case "3" -> playerPickedSurrender(color);
|
||||||
default -> false;
|
default -> false;
|
||||||
};
|
};
|
||||||
} while (!endTurn);
|
} while (!endTurn);
|
||||||
@@ -106,7 +111,6 @@ public class Console implements OutputSystem {
|
|||||||
@Override
|
@Override
|
||||||
public void gameStarted() {
|
public void gameStarted() {
|
||||||
System.out.println("Game start:");
|
System.out.println("Game start:");
|
||||||
updateDisplay();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user