lots of things
This commit is contained in:
24
app/src/main/java/chess/io/commands/SurrenderCommand.java
Normal file
24
app/src/main/java/chess/io/commands/SurrenderCommand.java
Normal file
@@ -0,0 +1,24 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user