Javascript implementation of chaos game - used for plotting fractals