Java code for simulating various physical games