I don't see how you can determine worldSize with x*y, it assume that the user will pass a square in without enforcing it. I prepose the following to allow a rectangle world to be created