Need help with some logic in my sketch.

Does that answer your question? Think you could help me out? A friend help me modify the sketch I'm using but neither of us can figure out how or where to put the boolean statements.