-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathBoardInterface.java
More file actions
36 lines (30 loc) · 830 Bytes
/
BoardInterface.java
File metadata and controls
36 lines (30 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package ticTacToe;
public class BoardInterface implements Position {
MnkBoard board;
public BoardInterface(MnkBoard board) {
this.board = board;
}
public boolean isValid(Move move) {
return board.isValid(move);
}
public Cell getCell(int r, int c) {
return board.getCell(r, c);
}
public String toString() {
return board.toString();
}
public boolean equals(Object o) {
if (!(o instanceof MnkBoard)) {
return false;
}
System.err.println("bruh?");
for (int i = 0; i < board.m; i++) {
for (int j = 0; j < board.n; j++) {
if (board.getCell(i, j) != ((MnkBoard) o).getCell(i, j)) {
return false;
}
}
}
return true;
}
}