|
@@ -1,19 +1,35 @@
|
1
|
1
|
package rocks.zipcode.io.quiz3.arrays;
|
2
|
2
|
|
|
3
|
+import java.util.stream.IntStream;
|
|
4
|
+
|
3
|
5
|
/**
|
4
|
6
|
* @author leon on 09/12/2018.
|
5
|
7
|
*/
|
6
|
8
|
public class TicTacToe {
|
|
9
|
+ private String[][] board;
|
7
|
10
|
|
8
|
11
|
public TicTacToe(String[][] board) {
|
|
12
|
+ this.board = board;
|
|
13
|
+ }
|
|
14
|
+
|
|
15
|
+ public TicTacToe(){
|
|
16
|
+
|
9
|
17
|
}
|
10
|
18
|
|
11
|
19
|
public String[] getRow(Integer value) {
|
12
|
|
- return null;
|
|
20
|
+ String[] row = new String[board[0].length];
|
|
21
|
+ for (int i =0; i< row.length; i++){
|
|
22
|
+ row[i] = board[value][i];
|
|
23
|
+ }
|
|
24
|
+ return row;
|
13
|
25
|
}
|
14
|
26
|
|
15
|
27
|
public String[] getColumn(Integer value) {
|
16
|
|
- return null;
|
|
28
|
+ String[] column = new String[board[0].length];
|
|
29
|
+ for (int i =0; i< column.length; i++){
|
|
30
|
+ column[i] = board[i][value];
|
|
31
|
+ }
|
|
32
|
+ return column;
|
17
|
33
|
}
|
18
|
34
|
|
19
|
35
|
public Boolean isRowHomogenous(Integer rowIndex) {
|