code to partition states based on a few sensor readings