It’s hard to get too far as a programmer without dealing with bit-masks at some point in your career. Barry’s co-worker made sure to build a nice, easily re-usable block of code to help with that. This simple block can simply be copy-pasted anywhere bit-masks are used. And it is.

var rules = [];
if ( inputInt == 0 ) {
                   rules[0] = 0;
                   rules[1] = 0;
                   rules[2] = 0;
                   rules[3] = 0;
                   rules[4] = 0;
                   rules[5] = 0;
                   rules[6] = 0;
                   rules[7] = 0;
} else if ( inputInt == 1 ) {
                   rules[0] = 0;
                   rules[1] = 0;
                   rules[2] = 0;
                   rules[3] = 0;
                   rules[4] = 0;
                   rules[5] = 0;
                   rules[6] = 0;
                   rules[7] = 1;
} else if ( inputInt == 2 ) {
                   rules[0] = 0;
                   rules[1] = 0;
                   rules[2] = 0;
                   rules[3] = 0;
                   rules[4] = 0;
                   rules[5] = 0;
                   rules[6] = 1;
                   rules[7] = 0;
} /* SNIP */ 
else if ( inputInt == 255 ) {
                   rules[0] = 1;
                   rules[1] = 1;
                   rules[2] = 1;
                   rules[3] = 1;
                   rules[4] = 1;
                   rules[5] = 1;
                   rules[6] = 1;
                   rules[7] = 1;
}