Last active
March 9, 2016 08:41
-
-
Save irwins/e5a579325e28d0070a7b to your computer and use it in GitHub Desktop.
Revisions
-
irwins revised this gist
Mar 9, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,9 +7,9 @@ Param ( ) #region Define regex results. Make search case-insensitive just incase. [regex]$whiteWin = '(?i)result\s+"1-0"' [regex]$blackWin = '(?i)Result\s+"0-1"' [regex]$Tie = '(?i)result\s+"1/2.*' #endregion #region Main Process All pgn files -
irwins revised this gist
Mar 7, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,9 +7,9 @@ Param ( ) #region Define regex results. Make search case-insensitive just incase. [regex]$whiteWin = '\[(?i)result\s+"1-0"\]' [regex]$blackWin = '\[(?i)Result\s+"0-1"\]' [regex]$Tie = '\[(?i)result\s+"1/2-1/2"\]' #endregion #region Main Process All pgn files -
irwins revised this gist
Mar 5, 2016 . 1 changed file with 22 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,33 @@ [CmdletBinding()] Param ( [ValidateScript({ Test-Path $_ } )] [string]$ChessMatchesPath = 'C:\Users\Irwin\Downloads\ChessData-master\ChessData-master', [switch]$DisplaySumTotal ) #region Define regex results. Make search case-insensitive just incase. [regex]$whiteWin = '\[(?i)result "1-0"\]' [regex]$blackWin = '\[(?i)Result "0-1"\]' [regex]$Tie = '\[(?i)result "1/2-1/2"\]' #endregion #region Main Process All pgn files Get-ChildItem -Path $ChessMatchesPath -File *.pgn -Recurse | ForEach-Object { $pgnFile = Get-Content $_.FullName -Raw [PSCustomObject]@{ FileReference = $_.Name WhiteWin = @($whiteWin.Matches($pgnFile)).Count BlackWin = @($blackWin.Matches($pgnFile)).Count Tie = @($Tie.Matches($pgnFile)).Count } } -OutVariable ChessResults If($DisplaySumTotal){ "`n`r" 'Total wins White: {0}' -f ($ChessResults.WhiteWin | Measure-Object -Sum).Sum 'Total wins Black: {0}' -f ($ChessResults.BlackWin | Measure-Object -Sum).Sum 'Total ties: {0}' -f ($ChessResults.Tie | Measure-Object -Sum).Sum } #endregion -
irwins revised this gist
Mar 4, 2016 . No changes.There are no files selected for viewing
-
irwins revised this gist
Mar 4, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,9 +10,9 @@ ForEach-Object { $pgnFile = Get-Content $_.FullName -Raw [PSCustomObject]@{ FileReference = $_.Name WhiteWin = @($whiteWin.Matches($pgnFile)).Count BlackWin = @($blackWin.Matches($pgnFile)).Count Tie = @($Tie.Matches($pgnFile)).Count } } | Export-Csv .\export\ChessMatchesResults.csv -Delimiter "`t" -NoTypeInformation -
irwins created this gist
Mar 4, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #region Define regex results [regex]$whiteWin = '\[Result "1-0"\]' [regex]$blackWin = '\[Result "0-1"\]' [regex]$Tie = '\[Result "1/2-1/2"\]' #endregion #region Main Process All pgn files Get-ChildItem -Path C:\Users\Irwin\Downloads\ChessData-master\ChessData-master -File *.pgn -Recurse | ForEach-Object { $pgnFile = Get-Content $_.FullName -Raw [PSCustomObject]@{ FileReference = $_.Name WhiteWin = ($whiteWin.Matches($pgnFile)).Count BlackWin = ($blackWin.Matches($pgnFile)).Count Tie = ($Tie.Matches($pgnFile)).Count } } | Export-Csv .\export\ChessMatchesResults.csv -Delimiter "`t" -NoTypeInformation #endregion