Skip to content

Commit

Permalink
remove numHomeGamesByTeam & numAwayGamesByTeam
Browse files Browse the repository at this point in the history
  • Loading branch information
inker committed Aug 19, 2024
1 parent cafcdcf commit 486dc1c
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/engine/dfs/ls/generateSchedule/getFirstSuitableMatchday.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ export default ({
);
// team:md
const locationByMatchday: Record<`${number}:${number}`, 'h' | 'a'> = {};
const numHomeGamesByTeam: Record<number, number> = {};
const numAwayGamesByTeam: Record<number, number> = {};

for (const pickedMatchday of shuffle(range(numMatchdays))) {
const solution = findFirstSolution(
Expand All @@ -55,8 +53,6 @@ export default ({
numMatchesByMatchday,
pickedMatchday,
locationByMatchday,
numHomeGamesByTeam,
numAwayGamesByTeam,
},
{
reject: c => {
Expand Down Expand Up @@ -150,15 +146,6 @@ export default ({
[`${pickedMatch[1]}:${c.pickedMatchday}`]: 'a',
} satisfies typeof c.locationByMatchday;

const newNumHomeGamesByTeam = {
...c.numHomeGamesByTeam,
[pickedMatch[0]]: (c.numHomeGamesByTeam[pickedMatch[0]] ?? 0) + 1,
} as typeof c.numHomeGamesByTeam;
const newNumAwayGamesByTeam = {
...c.numAwayGamesByTeam,
[pickedMatch[1]]: (c.numAwayGamesByTeam[pickedMatch[1]] ?? 0) + 1,
} as typeof c.numAwayGamesByTeam;

const newSchedule = [
...c.schedule,
c.pickedMatchday,
Expand All @@ -185,8 +172,6 @@ export default ({
numMatchesByMatchday: newNumMatchesByMatchday,
pickedMatchday: i,
locationByMatchday: newLocationByMatchday,
numHomeGamesByTeam: newNumHomeGamesByTeam,
numAwayGamesByTeam: newNumAwayGamesByTeam,
});
}

Expand Down

0 comments on commit 486dc1c

Please sign in to comment.