You can run the simulation right here in your browser!
Click on the ▶ symbol to run the simulation of a red dot ("predator") learning to move towards a blue dot ("prey"):
You can look at the code again by clicking on the pencil icon.
Based on code from:
http://hchiam.blogspot.ca/2016/08/machine-learning-very-basic-code.html
GitHub repo:
https://github.com/hchiam/machineLearning/blob/master/predatorSim1D.py