Created
July 18, 2025 02:00
-
-
Save nikhil-RGB/11cd723e9e541f0d9d7e8e95e813e12c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| List<Checkers> continuedCapture(Point source, List<List<Point>> moves) { | |
| Checkers refBoard = this; | |
| List<Checkers> boards = []; | |
| for (List<Point> capDiagonal in moves) { | |
| Checkers childBoardCap = refBoard.cloneGame(); | |
| List<List<Point>> newCaps = | |
| childBoardCap.executeCapture(source, capDiagonal); | |
| newCaps = childBoardCap.kingAfterMove(capDiagonal[1]) | |
| ? childBoardCap.captureSequences(capDiagonal[1]) | |
| : newCaps; | |
| if (newCaps.isEmpty) { | |
| boards.add(childBoardCap); | |
| } else { | |
| Point newSource = capDiagonal[1]; | |
| boards.addAll(childBoardCap.continuedCapture(newSource, newCaps)); | |
| } | |
| } | |
| return boards; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment