I plan on simulating this game. Can anyone help me with the physics aspects of it? Thanks in advance.

http://www.addictinggames.com/magnetism.html