in ,

Junior devs at their finest (tic tac toe winner checks)

Junior devs at their finest

if (board[01[0].contains(“X”) && board[0][1].contains(“X”) && board[0][2] contains (“X”)) 1

winner = playerNames [01;

if (board[11[0] contains (“X”) && board [1][1] contains (“X”)

&& board [1][2]. contains (“X”)) l

winner = playerNames [0];

if (board[21|01.contains(“X”) && board[2][1]. contains (“X”)

&& board[2][2].contains (“x”)) {

winner = playerNames [0];

if (board|01|01.contains(“X”) && board[11101.contains(“X”) && board[2110]. contains (“x”)) i

winner = playerNames [0];

if (board[0][11.contains(“X”) && board [1][1] contains(“X”) && board[2][1] contains(“X”)) l

winner = playerNames [0];

if (board[11[2].contains(“X”) && board [1][2].contains(“X”)

&& board [21[2] contains(“X”)) i

winner = playerNames [0];

if (board[0][01.contains(“X”) && board[1][1] contains (“X”)

&& board[21121.contains(“X”)) 1

winner = playerNames [0];

if (board[2][01.contains(“X”)

&& board [11[11.contains(“X”)

&& board[0][2].contains(“X”)) (

winner = playerNames [0];

}

if (board[0][0].contains(“0”) && board[0][1].contains(“0”) && board[0][2]. contains(“0”)) €

winner = playerNames [11;

if (board[1][0].contains(“0”) && board[1][1]. contains(“0”) && board[11[2] contains(“0”)) {

winner = playerNames [1];

if (board[2][0].contains(“0”) && board[2][1].contains(“0”) && board[2][2]. contains(“0”)) {

winner = playerNames [11;

if (board[0][0].contains(“0”) && board[1][0].contains(“0”) && board[2][0].contains (“0”)) €

winner = playerNames [1];

}

if (board[0][1].contains(“0”) && board[1][1] .contains(“0”) && board[2][1]. contains (“0”)) k

winner = playerNames [1];

if (board[0][0].contains(“0”) && board[1][1]. contains(“0”) && board[2][2]. contains (“0”)) {

winner = playerNames [1];

What do you think?

Written by codeitbro

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings