fixed diamond square function