Author | Message | Time |
---|---|---|
Tontow | Here is the challenge that I'm faceing (and I challenge you to solve it); Everyone knows that a tournament has rounds that are halfe the size of the previous round. IE: 32, 16, 8, 4, 2, 1 Assume that each slot is numbered starting at 0 and ending at the winners slot. IE: 0 32 48 56 60 62 1 33 49 57 61 2 34 50 58 3 35 51 59 4 36 52 5 37 53 6 38 54 7 39 55 8 40 9 41 10 42 11 43 12 44 13 45 14 46 15 47 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Also, assume that the size of the tournament varies. IE: It could be 32 or 2 or 4 or 8 or 64 or 128 or etc. Although it is easy to visually see and say, "this slot will advance to this slot", I want to findout a mathmatical formula that will say, "this slot will advance to this slot". So, Starting with the number of the slot that you want to advance to the next round, find a mathamatical formula or process that will always tell you wich slot number to advance to. edit: For example, the result for 0 or 1 in a 32 man tournament would be 32, 2 and 3 would be 33 etc. | June 22, 2005, 7:15 PM |
Darkness | If you don't mind the use of the floor function, then its not bad. Since I can't really represent it very well with ASCII, lets just say [x] = greatest integer less than or equal to x. n = number of people in first round. s = slot you want to advance formula: [s/2] + n | June 23, 2005, 5:08 AM |
Tontow | :o I tryed that formula in my program and it worked; I've gone though a ton of scrach papper to figur that out; and my solution was long and confuseing (I figured that there had to be a better way). | June 23, 2005, 7:00 AM |