generate grid and place pipes randomly