"OR " , "AND" logic

mOskit:
If any pair goes dark, While must stop.

That's the inverse of the first statement. Just to recap:

  • A and B, C and D etc form pairs?
  • If one of the pins from a pair is connected you're good?
  • Stop if one (or more) pairs loose both connections?

Apart from that, because all those inputs have a close relation I would say an array and looping over it would and break on a disconnect would make more sens. Easier to write, extend and view.

Pseudocode

bool pairs[4][2];

while(true){
  for(byte i = 0; i < NrPairs; i++){
    if( !( pairs[i][0] || pairs[i][1] ) ){
      break;
    }
  }
}