made grid and object drawing on grid based on its value in the 3d array