I will describe the algorithm in question with an example:
I have a piece, lets say piece number 7
.
I have a 4 x 4
sized puzzle with id's
00 01 02 03
10 11 12 13
20 21 22 23
30 31 32 33
I need to determine the correct location for piece 7
The location would be 12
I'm writing this in python and think I could use a bruit force method. I've tried counting up and reaching the location I need.
Any ideas for a simple algorithm? The output needs to to be the same since I'm working with legacy code.