tournament-js/duel

challonge double elimination bracket movement

Closed this issue · 6 comments

clux commented

Storage issue for notes on how challonge drops down. Tested a few tournaments.

clux commented

p = 6 - 64 players

http://challonge.com/msezbs80

WBR1

Does not set up by putting even seeds at the bottom

LBR1

Behaves completely as in clux/duel in that WBR1 drops to LBR1 in exactly the same way

Even LB rounds

Loser always drop to idx 0 (not always the same as in duel - may be the bracket movement)

WBR2 -> LBR2

Reverses map order completely when going down : m_i to m_{16-i}:

M1  -> M16
M2  -> M15
M3  -> M14
M4  -> M13
M5  -> M12
M6  -> M11
M7  -> M10
M8  -> M9
M9  -> M8
M10 -> M7
M11 -> M6
M12 -> M5
M13 -> M4
M14 -> M3
M15 -> M2
M16 -> M1

WBR3 -> LBR4

Rverses in chunks of two, but same style of split as in LBR2:

M1 -> M4
M2 -> M3
M3 -> M2
M4 -> M1

M5 -> M8
M6 -> M7
M7 -> M6
M8 -> M5

WBR4 -> LBR6

Now it's less clear what's going on. Presumably still reversing in chunks of two, but now with each chunk having reversed order:

M1 -> M3
M2 -> M4
M3 -> M1
M4 -> M2
clux commented

p=8 - 256 players

http://challonge.com/rwj541lx

WBR2 -> LBR2

match i -> match (64-i)

WBR3 -> LBR4

WBR3 and LBR4 both 32 matches
Drops in chunks of two

M1  -> M16
M2  -> M15
..
M15 -> M2
M16 -> M1
M17 -> M32
M18 -> M31
..
M31 -> M18
M32 -> M17

WBR4 -> LBR6

Both 16 matches.
Drops in chunks of two, reversed order in chunks:

M1 -> M9
M2 -> M10
..
M7 -> M15
M8 -> M16
M9  -> M1
M10 -> M2
..
M15 -> M7
M16 -> M8

WBR5 -> LBR8

Both 8 matches.
A break in the pattern:

M1 -> M1
M2 -> M2
M3 -> M3
M4 -> M4
M5 -> M5
M6 -> M6
M7 -> M7
M8 -> M8

WBR6 -> LBR10

Both 4 matches IO,IP,IQ,IR
Another break in the pattern, but it is clearer now.

M1 -> M4
M2 -> M3
M3 -> M2
M4 -> M1

WBR7 -> LBR12

Two matches IS and IT
At this point we should just be confirming the formula

M1 -> M1
M2 -> M2
clux commented

So generally, down for WB round r, the algorithm seems to be:

if Math.floor(r/2) is even: # round 2, 3,  not 1,4,5
  "reverse the match list"

if Math.floor((r+1)/2) is even: # round 3, 4 not 1, 2, 5, 6
  "split the match list in two, shift bottom split to the top"

May have to generate a 512 to verify at the edges, but looks like R7 is consistent with reversing, then splitting (which actually look like doing neither in the case where there are two matches).

Which seems sensible. It alternates the two important permutation aspects and seems likely to maximize chances of replays between players.

clux commented

256 is max on challonge, so think my assumptions are sensible here anyway. Now just need to convert this into a down implementation.

clux commented
var mixLbGames = function (p, round, game) {
  var numGames = Math.pow(2, p - round);
  var midPoint = Math.floor(Math.pow(2, p - round - 1));

  // reverse the match list map in round 2,3,5,6,..
  var reversed = $.odd(Math.floor(round/2));
  var partitioned = $.even(Math.floor((round + 1)/2));

  // split the match list map in two change order and rejoin the lists
  if (partitioned) {
    if (reversed) {
      return (game > midPoint) ? numGames - game + midPoint + 1 : midPoint - game + 1;
    }
    return (game > midPoint) ?  game - midPoint : game + midPoint;
  }
  // dont split
  return reversed ? numGames - game + 1 : game;
};

This seems to mix it up according to these rules. Still a little uncertain about the end points when midPoint is not an integer, but think we just floor then. Edit; yes we floor. Thus always in the LHS of the expressions and they you always get 1. That is, as long as numGames is 1 - which it always is when the round number exist in WB for a tournament of power p. Can perhaps assert that round <= p.

clux commented

Will turn this thread into testcases eventually, now just need to decide on a name.