Jim Hester wrote:This is updating 'n' with the new array, when what I really want it to do is to leave 'n' alone, and update swapArray so I can pass that array into a new Node.
Well, I don't know what "n" is, but that aside: I was asking if you're operating on a single array. If you're passing around a reference to a single array, then there's only one array to operate on, and it's the only one that will be modified. If you want to keep the original array, and operate only on a duplicate (without altering the original), you'd need to copy it.
is there a better way of going through the movement options than this giant if statement?
Almost certainly. The trick is to identify what's the same, and what's different, in each block. From a cursory examination it looks like it's just a couple of indices that change based on the position, leading me to believe that the other numbers could be generated using math.