function prob = W(n,x,y)
%
% Compute W^n(ybar|xbar) for the BSC(p) channel,
% where xbar is the vector of bits representing x,
% ybar is the vector of bits representing y,
% ybar = xbar + zbar, addition is mod 2,
% and the bits of zbar are i.i.d. Bernoulli(p); i.e., P(Z_i=1) = p.
%
p = .1;
Hw = sum(bitget(bitxor(x,y),[1:n])); % Hamming distance between xbar and ybar
prob = p^Hw*(1-p)^(n-Hw);