Skip to content

Commit

Permalink
remove unnecessary sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
inker committed Jul 5, 2024
1 parent 67ef364 commit ea42c5b
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/engine/dfs/ls/generatePairings/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { orderBy, range, shuffle } from 'lodash';
import { range, shuffle } from 'lodash';

import generateFull from './generateFull';
import getFirstSuitableMatch from './getFirstSuitableMatch.wrapper';
Expand All @@ -22,22 +22,6 @@ export default async function* generatePairings<T>({

allGames = [...allGames, ...allGames.map(([a, b]) => [b, a] as const)];

allGames = orderBy(allGames, [
m => Math.min(...m),
m => Math.max(...m),
// () => Math.random(),
// ([a, b]) => {
// if (a % 2 === 0 && b - a === 1) {
// return 0.0000000001 * a;
// }
// if ((a - b === 3 && b % 4 === 0) || (a - b === 1 && b % 4 === 1)) {
// return 0.0001 * a;
// }
// return Number.POSITIVE_INFINITY;
// },
// ([a, b]) => -Math.abs(a - b),
]);

allGames = allGames.filter(([h, a]) => isMatchPossible(teams[h], teams[a]));

const matches: (readonly [number, number])[] = [];
Expand Down

0 comments on commit ea42c5b

Please sign in to comment.