so I got a ranking system, which is basically a pyramid:
01
02 03
04 05 06
07 08 09 10
11 12 13 14 15
16 17 18 19 20 21
Now each person can challenge each person to the left in the same line and to the right in the line above.
So, for example, 18 may claim 13-17
. Basically, you can challenge further up the stairs than lower.
Any idea on how to solve this problem as a function? When you think about a problem, I just come up with rather complicated calculations for the range, calculating the pyramid layer by counting, but I'm sure there should be a simple solution.
A few more examples for the ranges:
02 - 01
03 - 02
04 - 02-03
05 - 03-04
06 - 04-05
07 - 04-06
08 - 05-07
11 - 07-10
17 - 12-16
By the way, although it may look like homework, I can assure you that I have not studied for several years. This is actually part of the staircase archery system that I am trying to digitize for a local archery club :)
source
share