An investigation of design principles underlying repulsive and attractive gradient sensing and their switching.