All values of boolean-triple
I'll give you a hint. Think of a &amp;&amp; b &amp;&amp; c as a 3 digit binary number 

So all possibles values will be:

a | b | c
0 | 0 | 0
0 | 0 | 1
0 | 1 | 0
0 | 1 | 1
1 | 0 | 0
1 | 0 | 1
1 | 1 | 0
1 | 1 | 1


As you can see, you want to flip c every time and check the value of a and b to determine what they will be. b will change any time c is 1 and a will change any time b and c are 1. This should be enough to give you a better implementation.