Ad
export function determineTicTacToeWinner(board: string[][]): string {
  for (let i = 0; i < 3; i++) {
    if (board[i][0].toLowerCase() === 'x' && board[i][1].toLowerCase() === 'x' && board[i][2].toLowerCase() === 'x' ||
        board[0][i].toLowerCase() === 'x' && board[1][i].toLowerCase() === 'x' && board[2][i].toLowerCase() === 'x' ||
        board[0][0].toLowerCase() === 'x' && board[1][1].toLowerCase() === 'x' && board[2][2].toLowerCase() === 'x' ||
        board[0][2].toLowerCase() === 'x' && board[1][1].toLowerCase() === 'x' && board[2][0].toLowerCase() === 'x') {
      return 'X';
    }
    if (board[i][0].toLowerCase() === 'o' && board[i][1].toLowerCase() === 'o' && board[i][2].toLowerCase() === 'o' ||
        board[0][i].toLowerCase() === 'o' && board[1][i].toLowerCase() === 'o' && board[2][i].toLowerCase() === 'o' ||
        board[0][0].toLowerCase() === 'o' && board[1][1].toLowerCase() === 'o' && board[2][2].toLowerCase() === 'o' ||
        board[0][2].toLowerCase() === 'o' && board[1][1].toLowerCase() === 'o' && board[2][0].toLowerCase() === 'o') {
      return 'O';
    }
  }
  return 'Draw game';
}