tags:

views:

14

answers:

0

Context: I have a box (objA) and want to compare it to surrounding boxes. If two surrounding boxes in any of 10 configurations share a property with objA I want to add them along with objA to a list. Preferably no box would be added to the list more than once, though it is non-essential.

Current logic: (x is a boolean for whether or not objX shares the property with objA)

if(b)
    if(c || d || e || f)
        add(objA)
        add(objB)
    if(c)
        add(objC)
    if(d)
        add(objD)
    if(e)
        add(objE)
    if(f)
        add(objF)

if(c)
    if(d || e || g)
        add(objA)
        add(objC)
    if(d)
        add(objD)
    if(e)
        add(objE)
    if(g)
        add(objG)

if(d)
    if(e || h)
        add(objA)
        add(objD)
    if(e)
        add(objE)
    if(h)
        add(objH)

if(e && i)
    add(objA)
    add(objE)
    add(objI)