Two arrays, where items in array x can be in array y but not vice versa, test all permutations
A small application that I have written allows a user to add various items to two arrays. Some logic calculates a figure from the contents of each array. Any items in array x can be placed into array y, and back again. Items belonging in array y can never be moved (unless they were moved from array x). The user can move these items around in two lists using a simple javascript ui. To make things simpler, I originally made a naive script which: Moved an item from a to y. Performed some logic using this 'possibility' If the result was less than before, leave x in y. If not, then x remains in x.