-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from BlazingTwist/27-fix-move-simulator
27 fix move simulator
- Loading branch information
Showing
22 changed files
with
374 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
src/main/java/jchess/common/events/ComputeAttackInfoEvent.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
package jchess.common.moveset; | ||
|
||
import jchess.common.IChessGame; | ||
import jchess.ecs.Entity; | ||
|
||
public record MoveIntention(Entity displayTile, Runnable onClick, IMoveSimulator moveSimulator) { | ||
|
||
/** | ||
* This is a utility Method for constructing a MoveIntention in the specific use-case where the moveSimulator matches the actual move. | ||
*/ | ||
public static MoveIntention fromMoveSimulator(IChessGame game, Entity displayTile, IMoveSimulator moveSimulator) { | ||
return new MoveIntention( | ||
displayTile, | ||
() -> { | ||
moveSimulator.simulate(); | ||
game.endTurn(); | ||
}, | ||
moveSimulator | ||
); | ||
} | ||
|
||
public interface IMoveSimulator { | ||
void simulate(); | ||
|
||
void revert(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.