square generation script