Okay i am trying to make this generate for 4 8 and 16 size tournaments.
Here is my example
http://clansi.net/test2.php
but as you can see that would take alot of space and the runtime slow.
I also want to learn to generate it for learning purpose's
Also i can see a math equation in it
Round 1 starts at box 1 (having 0 being the round name) then goes adding 2 after that for each name
Round 2 has 2 Space at the start (The spaces consecutive in round 1) and adds 4 consecutive.. (it doubles) the math equation is used throught the whole pattern
Given Start 1
Take the number before double it (2)
then use 2 and take that number and double it (4)
hard to explain but this is just babling haha just if you can help me generate that tournment by actually inputting any number that would be great
Tournament Generate
Started by Whitey, Aug 21 2008 05:22 AM
6 replies to this topic
#1
Posted 21 August 2008 - 05:22 AM
|
|
|
#2
Posted 21 August 2008 - 09:56 AM
The first thing I would do is work out a relationship between the number of teams playing and the number of rounds played.
#3
Posted 21 August 2008 - 12:20 PM
Well if i do it by 4 - 8 - 16 it would be 3 - 4 - 5
#4
Posted 21 August 2008 - 04:36 PM
How about if you did it by "n" - any arbitrary number? Then what would it be (in terms of n).
#5
Posted 27 August 2008 - 12:32 PM
Thats really hard to make i am confusing myself when trying to make it
#6
Posted 27 August 2008 - 12:42 PM
Try looking at it like this:
Teams : Rounds 1 : 0 2 : 1 3-4 : 2 5-8 : 3 9-16 : 4 17-32 : 5In particular, notice that the high values are powers of two
Edited by WingedPanther, 27 August 2008 - 12:44 PM.
formatting
#7
Posted 28 August 2008 - 02:58 AM
number of rounds is the same as the highest bit has in the byte-value that has a 1
ex:
11 = 00001011; 4th bit is set with means we will have 4 rounds
23 = 00010111; 5th bit is set -> 5 rounds
then it's "just" to write a nice procedure to calculate this...
this function works for up to 16384 players, if more needed, just change the value in the for-loop, from 16 to a higher value. Just put number of players as parameter to the function. highbit(57) would give 6 (max 64) and highbit(23) would give 5 (max 32)
ex:
11 = 00001011; 4th bit is set with means we will have 4 rounds
23 = 00010111; 5th bit is set -> 5 rounds
then it's "just" to write a nice procedure to calculate this...
function highbit($a) {
$highbit = 0;
$bitcomp = 1;
for ($i=1; $i<16; $i++) {
if ($a & $bitcomp) {
$highbit = $i;
}
$bitcomp = $bitcomp << 1;
}
return $highbit;
}
this function works for up to 16384 players, if more needed, just change the value in the for-loop, from 16 to a higher value. Just put number of players as parameter to the function. highbit(57) would give 6 (max 64) and highbit(23) would give 5 (max 32)
Edited by Orjan, 28 August 2008 - 03:42 AM.
Added an function


Sign In
Create Account


Back to top









