diff --git a/src/CheckersGameState4.java b/src/CheckersGameState4.java index 4b69121..08c74f6 100644 --- a/src/CheckersGameState4.java +++ b/src/CheckersGameState4.java @@ -84,8 +84,39 @@ public class CheckersGameState4 implements CheckersGameState{ return jumps; } - int[] computeJumps(Piece p, int i){ - return null; + ArrayList computeJumps(Piece p, int neighborIndex, Move4 lastMove){ + ArrayList jumps = new ArrayList(); + int[] nextSpot = dest(p, neighborIndex); + Piece captured = spotContains(nextSpot[0], nextSpot[1]); + Move4 last = lastMove; + if(last == null) { + // This is the first jump + // Make our move + last = new Move4(p, dest(captured, neighborIndex), captured); + } + // Check to see if we can keep going + // if we can, jumps.addAll(computeJumps(p, newgoodindex, nextMove)) + // else, add(nextMove) + int lastRow = last._path[last._path.length-2]; + int lastCol = last._path[last._path.length-2]; + Piece[] newneighbors = neighborPieces(lastRow, lastCol, p); + for(int i = 0; i