Changed code for generating pieces and give them positions so its dynamic.