Skip to content

Commit

Permalink
randomise order
Browse files Browse the repository at this point in the history
  • Loading branch information
inker committed Jul 10, 2024
1 parent 95f7a76 commit 17ad295
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/engine/dfs/ls/generatePairings/getFirstSuitableMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,11 @@ export default ({
const unorderedPotPairs = cartesian(potIndices, potIndices);
const potPairs = orderBy(unorderedPotPairs, [m => m[0], m => m[1]]);

const orderedRemainingGames = orderBy(remainingGames, [
m => {
const hPot = Math.floor(m[0] / numTeamsPerPot);
const aPot = Math.floor(m[1] / numTeamsPerPot);
return potPairs.findIndex(([a, b]) => a === hPot && b === aPot);
},
m => m[0],
]);
const orderedRemainingGames = orderBy(remainingGames, m => {
const hPot = Math.floor(m[0] / numTeamsPerPot);
const aPot = Math.floor(m[1] / numTeamsPerPot);
return potPairs.findIndex(([a, b]) => a === hPot && b === aPot);
});

return orderedRemainingGames.find(match => {
const solution = findFirstSolution(
Expand Down

0 comments on commit 17ad295

Please sign in to comment.