I think a proper structure for that (see that i say "a" not "the") is a state machine structure, a while loop with a case structure inside, where you put different tests. You can pass your array using a shift register, and depending the state you select, you'll have different outputs in the same array.
Hope this can point you in the right direction, if you need more info or an example, just ask for it.