 If there is exactly one yellow light
 Flip on the first 4 switches from left to right

 Otherwise if there are exactly 2 yellow lights
 Flip on the middle switch

 Otherwise if there are exactly 3 yellow lights and they are separate

 Otherwise if there are exactly 3 yellow lights and they are adjacent to each other
 Flip on last 3 switches from left to right

 Otherwise if there are 4 yellow lights but and the first and last lights are not lit
 Flip on 2 switches, the first and the last from left to right

 Otherwise if there is an even number of yellow lights
 Flip on the first 2 switches from left to right

 Otherwise if there is an odd number of yellow lights
 Flip on an the second and fourth switches from left to right
