Computer Science This is a codingbat problem. Please answer in Java and do not change the starter code. You have been asked to write the game of tic tac toe. In the first version of the game, we will only be comparing horizontally for a win. A win is determine by all of the elements in a row either being an X or an O. You need to return a String with the winner or TIE if there is no winner. ticTacToe(["X", "O", "O"], ["X", "O", "O"], ["X", "X", "X"]) → "X" ticTacToe(["X", "O", "X"], ["X", "X", "O"], ["O", "O", "O"]) → "O" ticTacToe(["X", "O", "X"], ["X", "X", "O"], ["O", "X", "O"]) → "TIE" public String ticTacToe(String[] top, String[] middle, String[] bottom) { }
Computer Science
This is a codingbat problem. Please answer in Java and do not change the starter code.
You have been asked to write the game of tic tac toe. In the first version of the game, we will only be comparing horizontally for a win. A win is determine by all of the elements in a row either being an X or an O. You need to return a String with the winner or TIE if there is no winner.
ticTacToe(["X", "O", "O"], ["X", "O", "O"], ["X", "X", "X"]) → "X"
ticTacToe(["X", "O", "X"], ["X", "X", "O"], ["O", "O", "O"]) → "O"
ticTacToe(["X", "O", "X"], ["X", "X", "O"], ["O", "X", "O"]) → "TIE"
public String ticTacToe(String[] top, String[] middle, String[] bottom) {
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images