-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
508 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// calculates how many games in the dataset | ||
export function countGamesInDataset(datasetPath: string): number { | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
let data = fs.readFileSync( | ||
path.join(__dirname, '../data/10.10.23_test_set'), | ||
'utf8' | ||
); | ||
let games = data.split('\n[Event'); | ||
// If the first game doesn't start with a newline, add 1 back to the count | ||
if (data.startsWith('[Event')) { | ||
console.log(`Number of games: ${games.length}`); | ||
return games.length; | ||
} else { | ||
console.log(`Number of games: ${games.length - 1}`); // Subtract 1 because the first split item will be an empty string | ||
return games.length - 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.