Construct A Bayesian Network Code