## Loops Controlling Lights The circuit above shows four loops controlling four lights.

## Rotate 1 Circuitry In the circuit above, if the 'rotate 1' key is not pressed, then loop3 controls light 3, loop 2 controls light 2, loop 1 controls light 1, and loop 0 controls light 0.

However, if the 'rotate 1' key is pressed, then loop 3 controls light 0, loop 2 controls light 3, loop 1 controls light 2, and loop 0 controls light 1. One can say that when the 'rotate 1' key is pressed, then the loop values are rotated one bit to the left. There is no bit to the left of bit 3, so bit 3 is rotated to the right end to bit 0.

The following table indicates what pressing the 'rotate 1' key does.

```                            Rotate Left
Rotate 1   Light Values   Amount in Bits
3 2 1 0
0      A B C D       0
1      B C D A       1
```

## Rotate Two Bits Circuitry In the circuit above, if the 'rotate 2' key is not pressed, then loop 3 controls light 3, loop 2 controls light 2, loop 1 controls light 1, and loop 0 controls light 0.

However, if the 'rotate 2' key is pressed, then loop 3 controls light 1, loop 2 controls light 0, loop 1 controls light 3, and loop 0 controls light 2. One can say that when the 'rotate 2' key is pressed, then the loop values are rotated two bits to the left.

The following table indicates what pressing the 'rotate 2' key does.

```                            Rotate Left
Rotate 2   Light Values   Amount in Bits
3 2 1 0
0      A B C D       0
1      C D A B       2
```

## Rotate Circuitry In the circuit above, if neither the 'rotate 1' key nor the 'rotate 2' key is pressed, then loop 3 controls light 3, loop 2 controls light 2, loop 1 controls light 1, and loop 0 controls light 0. If rotate 1 is pressed and rotate 2 is not pressed, then the loop signals are rotated 1 bit to the left on the way to the lights. If rotate 2 is pressed and rotate 1 is not pressed, then the loop values are rotated 2 bits to the left on the way to the lights. Finally, if both the rotate 1 key and the rotate 2 key are pressed, then the loop values are rotated three bits to the left. For example, the value in loop 0 is routed to light 3.

The following table indicates what pressing one or both 'rotate' keys does.

```                                      Rotate Left
Rotate 2   Rotate 1   Light Values   Amount in Bits
3 2 1 0
0          0      A B C D       0
0          1      B C D A       1
1          0      C D A B       2
1          1      D A B C       3
```

Page 18

Page 17 . . . Page 1 . . . Page 19