Created
March 22, 2016 01:53
-
-
Save 1RedOne/0d9e341c210dc01ae40c to your computer and use it in GitHub Desktop.
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
#oh man, everyone elses were so much better, this is embarassing... | |
#v3 | |
$folder = 0 | |
$pgnFiles = 'X:\ChessData-master\ChessData-master' | |
$blacktot=$whitetot=$null | |
$blacktot = new-object System.Collections.ArrayList | |
$whitetot = new-object System.Collections.ArrayList | |
$draw = new-object System.Collections.ArrayList | |
#-Activity "Processing $file" -PercentComplete (($i/$files.Count) * 100) -Status ("$i out of " + $files.Count +" completed "+[math]::Round((($i/$files.Count) * 100),2) +" %") | |
gci $pgnfiles | ForEach-object { | |
$folder++ | |
"processing $folder of 10" | |
#setting up base number | |
#write-progress -activity "Ham" -status "Sorting $($folder.Name)" -percentcomplete $(($folder/10)*100) -currentOperation OuterLoop | |
$i=0 | |
$files = gci $("$($_.FullName)\*.pgn") | |
ForEach ($file in $files){ | |
#increment | |
#$i++ | |
#Write-Progress -Activity "Processing $file" -id 1 -PercentComplete (($i/$files.Count) * 100) -Status ("$i out of " + $files.Count +" completed "+[math]::Round((($i/$files.Count) * 100),2) +" %") -currentOperation InnerLoop | |
Get-content $file.FullName |Select-String "Result" | % { | |
$black = $_.ToString().Substring(9,3)[0] | |
$white = $_.ToString().Substring(9,3)[2] | |
if ($black -eq $white){[void]$draw.Add('') ; return} | |
else {if ($black -gt $white){ | |
[void]$blacktot.Add('') | |
} | |
else{ | |
[void]$whitetot.Add('') | |
} | |
} | |
} | |
#End of File | |
} | |
#endofFolder | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment