25 lines
523 B
Java
25 lines
523 B
Java
package chess.io.commands;
|
|
|
|
import chess.io.Command;
|
|
import chess.io.CommandResult;
|
|
import chess.io.OutputSystem;
|
|
import chess.model.Color;
|
|
import chess.model.Game;
|
|
|
|
public class SurrenderCommand extends Command {
|
|
|
|
private final Color player;
|
|
|
|
public SurrenderCommand(Color player) {
|
|
this.player = player;
|
|
}
|
|
|
|
@Override
|
|
public CommandResult execute(Game game, OutputSystem outputSystem) {
|
|
outputSystem.hasSurrendered(player);
|
|
outputSystem.winnerIs(Color.getEnemy(player));
|
|
return CommandResult.NotMoved;
|
|
}
|
|
|
|
}
|