This is not my work, it is the work of Richard Teammco. This post is a subsection of his personal website. All credit goes to him, and all the other contributors to the GitHub repo linked at the bottom of the page. He has more interesting simulations if you check the "Misc" tab of his website, including one of a perceptron.