basic cube finding and painting logic