My issue: I have a matrix of integers which represent objects per-say. Like:

022 110 212

And I have them in a two dimensional array and I wish to transform this array of integers which represent objects that follow rules in how they can be transformed. Like:

//1 CAN ONLY GO DIAGONAL WITH 2 021 //< 1 has switched with the 2 120 //< The 2 located in the middle switched with the 1 in the upper right by 212 //the 1 being allowed to switch diagonal positions with the "1" integer/object.

Now I don't know if I have explained myself right but in-case I haven't here is an example of what the program I am trying to write must be able to do:

022 110 //ORIGINAL MATRIX 212 /**** STEPS ****/ 021 120 //1 CAN ONLY GO DIAGONAL WITH 2 212 021 102 //0 CAN ONLY GO HORIZONTAL WITH 2 212 022 101 //2 CAN ONLY GO VERTICAL WITH 1 212 /**** STEPS ****/ 022 101 //WANTED MATRIX 212

Now this is only an example which is why I do not wish to learn how to only solve the problem above but to learn HOW to solve problems like the one above they can change in rules and matrix size and complexity.

Thanks, Nois.

Note: I hope this is in the right category as I don't know if it should be in Programming Theory or not but I know that it is a open question for any developer of any language. Thus I chose General Programming.