Partial Sorting
A Partial Sorting is a special technique that can be used to randomly sort only a part of teams in a competition.
Implementation[edit | edit source]
Here's a possible implementation with UCP Scripting Syntax
#name "Partial Sorting example" // This example shows how to apply partial random sorting // to a pool with national teams comp WorldCup { // A pool with 20 teams - 10 teams from South America and 10 teams from Oceania. // We want to make random pairs, but we want South American teams to play with // Oceanian teams. So we can't use shuffleTeams() at the end of the script - it // will randomly sort all teams. We put the shuffleTeams() command in the middle, // and that's what we call a "partial sorting" round "Test round" @test teams 20 matchdays 3 { getNationalTeam(SouthAmerica) shuffleTeams() // will shuffle teams which are already added at this point getNationalTeam(Oceania) } }