We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8620604 commit c1f358aCopy full SHA for c1f358a
src/connect4/connectFour/Board.java
@@ -9,6 +9,23 @@ public class Board implements Grid
9
private int nextPlayer;
10
private int[][] playerAtPosition;
11
private ArrayList<Integer> undoList;
12
+
13
+ public Grid clone() {
14
+ Board ret = new Board(rows, cols);
15
16
+ ret.undoList = new ArrayList<Integer>(undoList);
17
+ ret.playerAtPosition = new int[rows][cols];
18
19
+ for(int i = 0; i < rows; i++) {
20
+ for(int j = 0; j < cols; j++) {
21
+ ret.playerAtPosition[i][j] = playerAtPosition[i][j];
22
+ }
23
24
25
+ ret.nextPlayer = nextPlayer;
26
27
+ return ret;
28
29
30
public Board(int rowsP, int colsP)
31
{
0 commit comments