87 76 67 58 49 40 31 22 13 4
77 68 59 50 41 32 23 14 5 -4
69 60 51 42 33 24 15 6 -3-12
61 52 43 34 25 16 7 -2-11-20
53 44 35 26 17 8 -1-10-19-28
45 36 27 18 9 0 -9-18-27-36
37 28 19 10 1 -8-17-26-35-44
29 20 11 2 -7-16-25-34-43-52
21 12 3 -6-15-24-33-42-51-60
I am using this grid of numbers to define levels in a pygame tile based dictionary of maps. Each number is a dictionary key defining a maps location in reference to each other map with the value being a 2d list. I need a function that returns the number of non diagonal moves away from 0 each number in the grid is. I am going to use this number to calculate difficulty level. So the farther the player gets from the origin point of 0 the more difficult the game gets. To better understand how these numbers are generated... A move North increments by 8, a move south increments by -8, a move east increments by -9, and a move west increments by 9. So for example maps 17,-1,1,and -17 would equal 2 while maps 8,9,-9,-8 would equal 1 and so on. I am making some headway learning to write decent code, but sometimes the math required is beyond my capabilities.