diff --git a/pom.xml b/pom.xml
index 3b8d043..2914565 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,6 +7,18 @@
rocks.zipcodewilmington
tic-tac-toe
1.0
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 11
+ 11
+
+
+
+
junit
diff --git a/src/main/java/rocks/zipcodewilmington/tictactoe/Board.java b/src/main/java/rocks/zipcodewilmington/tictactoe/Board.java
index f56452f..bc4f81b 100644
--- a/src/main/java/rocks/zipcodewilmington/tictactoe/Board.java
+++ b/src/main/java/rocks/zipcodewilmington/tictactoe/Board.java
@@ -4,23 +4,101 @@
* @author leon on 6/22/18.
*/
public class Board {
+ private Character [][] matrix; // Intitialized it
+
public Board(Character[][] matrix) {
+ this.matrix = matrix; // addded the thi.matrix....
+
+
}
+
public Boolean isInFavorOfX() {
- return null;
- }
+
+ int theX = 0;
+ int theO = 0;
+ Character[][] board = this.matrix;
+ if (isTie()){
+ return false;
+ }
+
+ for (int i = 0; i < 3; i++){
+ for(int j = 0; j < 3; j++){
+
+ if (board [i][j] == 'X') {
+ theX++;
+ }else if (board [i][j] == 'O'){
+ theO++;
+ }
+ }
+ }
+
+ return theX > theO;
+
+
+
+
+ } // favor of X
+
+
+
+
+
+
public Boolean isInFavorOfO() {
- return null;
+ return !isTie() && isInFavorOfX() == false;
}
public Boolean isTie() {
- return null;
+
+ return getWinner() == "";
}
+
+
+
+
+
+
+
+
+
public String getWinner() {
- return null;
- }
+ Character [][] board = this.matrix;
+
+ if (board[0][0] == 'X' && board[1][1] == 'X' && board[2][2] == 'X'){
+ return "X";
+ }else if (board[2][0] == 'X' && board[1][1] == 'X' && board[0][2] == 'X'){
+ return "X";
+ }else if (board[0][0] == 'O' && board[1][1] == 'O' && board[2][2] == 'O'){
+ return "O";
+ }else if (board[2][0] == 'O' && board[1][1] == 'O' && board[0][2] == 'O'){
+ return "O";
+ }
+
+ for (int i = 0; i < 3; i++){ // horizontal
+
+ if (board [i][0] == 'X' && board[i][1] == 'X' && board[i][2] == 'X'){
+ return "X";
+ }else if (board [i][0] == 'O' && board[i][1] == 'O' && board[i][2] == 'O'){
+ return "O";
+ }
+
+
+ } // for loop
+
+ for(int i = 0; i < 3; i++){ // vertical
+
+ if (board [0][i] == 'X' && board[1][i] == 'X' && board[2][i] == 'X'){
+ return "X";
+ }else if (board [0][1] == 'O' && board[1][i] == 'O' && board[2][i] == 'O'){
+ return "O";
+ }
+
+ } //2nd for loop
+
+ return "";
+ } // get winner
-}
+} // the last