-
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.
squashed a bunch of changes from temp branch
- Loading branch information
Showing
15 changed files
with
130 additions
and
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using ChessNotationConverter.Models; | ||
|
||
namespace ChessNotationConverter.Helpers | ||
{ | ||
internal static class TrainingDataHelper | ||
{ | ||
private static string outFile = "../../../../train_data.txt"; | ||
|
||
internal static void WritePositionsToTrainingFile(List<Evaluation> evaluations) | ||
{ | ||
using var sw = new StreamWriter(outFile, true); | ||
|
||
foreach (var evaluation in evaluations) | ||
{ | ||
if (evaluation.Position.BlackToMove) | ||
{ | ||
evaluation.Position = evaluation.Position.Invert(); | ||
if (evaluation.Score != 0) | ||
{ | ||
evaluation.Score = -evaluation.Score; // no need to invert 0 | ||
} | ||
} | ||
|
||
var outputStr = evaluation.Position.Serialize(true) + evaluation.Score; | ||
sw.WriteLine(outputStr); | ||
} | ||
} | ||
} | ||
} |
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
Binary file not shown.
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
Oops, something went wrong.