public class Experiment { public static void main (String [] argv) { PhysicsElement[] element = new PhysicsElement[3]; Block b1 = new Block(1e15f, 0f, 0f, 0f); // f: float Block b2 = new Block(1f, 0.10f, 1f, 0f); // mass, width, position, speed Spring spring = new Spring (0.7f, 1f); // rest length and stiffness spring.attachLeftBlock(b1); // do not change these prototypes spring.attachRightBlock(b2); b1.attachRightSpring (spring); b2.attachLeftSpring (spring); element[0] = b1; element[1] = spring; element[2] = b2; Simulator sim = new Simulator (); // do not change this class, //Thanks to inheritance code can be reuse. sim.setPhysicsElements(element); sim.simulate(0.001f, 20f, 0.1f); // delta time, total time, sampling time. } }