View Source ExTournaments.Utils.PairingHelpers (ExTournaments v0.5.1)

Collection of helpers to use in pairings algorithms

Link to this section Summary

Functions

Calculate exponent and remainder of the players by the power of 2

Takes count of matches and number of the current fill iteration. It will generate fill pattern to build matches flow.

Takes calculated remainder and return list of matches for the preliminary round

Takes list of %ExTournaments.Match{} structs, round index, first round index, calculated exponents and flag to toggle function.

Takes calculated exponent and return list of prefilled participants seed

Takes list of players IDs and according to the passed flag it will shuffle it.

Takes list of matches, first round index, list of players IDs and calculated exponent and remainder. It will set BYE to the matches in the first round by the remainder.

Takes list of matches, list of seeds, first round index, list of players IDs and calculated remainder. It will assign players to the matches by the list of seeds and shuffling algorithms.

Link to this section Functions

Link to this function

calculate_factors(players)

View Source
@spec calculate_factors([integer()]) :: tuple()

Calculate exponent and remainder of the players by the power of 2

Link to this function

fill_pattern(match_count, fill_count)

View Source
@spec fill_pattern(integer(), integer()) :: [integer()]

Takes count of matches and number of the current fill iteration. It will generate fill pattern to build matches flow.

Returns list of number for matches flow.

Link to this function

generate_preliminary_matches(remainder, round)

View Source
@spec generate_preliminary_matches(number(), integer()) :: [ExTournaments.Match.t()]

Takes calculated remainder and return list of matches for the preliminary round

Link to this function

generate_regular_matches(matches, round, starting_round, exponent, match_exponent, iterated)

View Source
@spec generate_regular_matches(
  [ExTournaments.Match.t()],
  non_neg_integer(),
  non_neg_integer(),
  number(),
  number(),
  boolean()
) :: {[ExTournaments.Match.t()], integer()}

Takes list of %ExTournaments.Match{} structs, round index, first round index, calculated exponents and flag to toggle function.

Returns tuple with a list of generated matches and count of rounds.

Link to this function

prefill_bracket(exponent)

View Source
@spec prefill_bracket(float()) :: [integer()]

Takes calculated exponent and return list of prefilled participants seed

Link to this function

prepare_players_list(players, ordered)

View Source
@spec prepare_players_list([integer()], boolean()) :: [integer()]

Takes list of players IDs and according to the passed flag it will shuffle it.

Link to this function

set_byes_for_first_round(matches, players_list, starting_round, exponent, arg5)

View Source
@spec set_byes_for_first_round(
  [ExTournaments.Match.t()],
  [integer()],
  integer(),
  number(),
  number()
) ::
  [ExTournaments.Match.t()]

Takes list of matches, first round index, list of players IDs and calculated exponent and remainder. It will set BYE to the matches in the first round by the remainder.

Returns list of matches with assigned BYE.

Link to this function

set_players_for_first_round(matches, bracket, starting_round, players_list, remainder)

View Source
@spec set_players_for_first_round(
  [ExTournaments.Match.t()],
  [integer()],
  non_neg_integer(),
  [non_neg_integer()],
  number()
) :: [ExTournaments.Match.t()]

Takes list of matches, list of seeds, first round index, list of players IDs and calculated remainder. It will assign players to the matches by the list of seeds and shuffling algorithms.

Returns list of matches with assign players to the first round.