Added accuracy tracking of predictions over time

This commit is contained in:
moosecrab 2020-02-25 01:33:31 -08:00
parent dabdbe501c
commit d37e289741
3 changed files with 52 additions and 6 deletions

View File

@ -40,7 +40,6 @@ Global
{E6794089-F810-402B-A3CE-0D7EA579108A}.Debug|Any CPU.Build.0 = Debug|Any CPU {E6794089-F810-402B-A3CE-0D7EA579108A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6794089-F810-402B-A3CE-0D7EA579108A}.Debug|x86.ActiveCfg = Debug|Any CPU {E6794089-F810-402B-A3CE-0D7EA579108A}.Debug|x86.ActiveCfg = Debug|Any CPU
{E6794089-F810-402B-A3CE-0D7EA579108A}.Release|Any CPU.ActiveCfg = Release|Any CPU {E6794089-F810-402B-A3CE-0D7EA579108A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6794089-F810-402B-A3CE-0D7EA579108A}.Release|Any CPU.Build.0 = Release|Any CPU
{E6794089-F810-402B-A3CE-0D7EA579108A}.Release|x86.ActiveCfg = Release|Any CPU {E6794089-F810-402B-A3CE-0D7EA579108A}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution

View File

@ -2,7 +2,7 @@
'Seconds between updates 'Seconds between updates
Const updatedelay = 2 Const updatedelay = 2
Const version As String = "1.9.12" Const version As String = "1.10"
Const downloadurl As String = "https://long-cat.net/projects/pepperbet/pepperbet.exe?v=" & version Const downloadurl As String = "https://long-cat.net/projects/pepperbet/pepperbet.exe?v=" & version
Const versionurl As String = "https://long-cat.net/projects/pepperbet/version.txt?v=" & version Const versionurl As String = "https://long-cat.net/projects/pepperbet/version.txt?v=" & version
Const dbfilename As String = "pepperdata.xml" Const dbfilename As String = "pepperdata.xml"
@ -12,7 +12,7 @@
Dim watching As Boolean = True Dim watching As Boolean = True
Dim autoupdate As Boolean = False Dim autoupdate As Boolean = False
Dim lastupdatecheck As New DateTime(0) Dim lastupdatecheck As New DateTime(0)
Dim accuracies(10) As Double Dim accuracies(9) As Double
'These are the time constants for the exponentially weighted falloff 'These are the time constants for the exponentially weighted falloff
Dim accuracytimeconstants() As Double = {10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000} Dim accuracytimeconstants() As Double = {10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000}
@ -89,12 +89,12 @@
Console.ForegroundColor = ConsoleColor.White Console.ForegroundColor = ConsoleColor.White
Console.WriteLine(" ╟──────────────────────────────") Console.WriteLine(" ╟──────────────────────────────")
'DONT FORGET TO CHANGE IT UP IN THE CONST 'DONT FORGET TO CHANGE IT UP IN THE CONST
Console.WriteLine("──────────────────────────────╢ v" & version & " ╟──────────────────────────────") Console.WriteLine("──────────────────────────────╢ v" & version & " ╟──────────────────────────────")
'DONT FORGET TO CHANGE IT UP IN THE CONST 'DONT FORGET TO CHANGE IT UP IN THE CONST
Console.WriteLine(" ╚════════════════╝") Console.WriteLine(" ╚════════════════╝")
Console.WriteLine() Console.WriteLine()
Console.ForegroundColor = ConsoleColor.Gray Console.ForegroundColor = ConsoleColor.Gray
Console.WriteLine("(C) 2013-2018 by moose crap http://long-cat.net") Console.WriteLine("(c) 2013-2020 by moose crap http://long-cat.net")
Console.WriteLine("Thanks to Fredstonemason for help and testing") Console.WriteLine("Thanks to Fredstonemason for help and testing")
Console.WriteLine() Console.WriteLine()
helpstring() helpstring()
@ -433,6 +433,14 @@
Console.Write("Automatic updates disabled") Console.Write("Automatic updates disabled")
End If End If
Console.CursorLeft = 0 Console.CursorLeft = 0
ElseIf tempkey.Key = ConsoleKey.R Then
Console.ForegroundColor = ConsoleColor.Gray
Console.BackgroundColor = ConsoleColor.Black
Console.WriteLine("Prediction accuracy")
For i = 0 To accuracies.Length - 1
Console.WriteLine("{0,5}: {1:0.000000}", accuracytimeconstants(i), accuracies(i))
Next
ElseIf tempkey.Key = ConsoleKey.C Then ElseIf tempkey.Key = ConsoleKey.C Then
Console.ForegroundColor = ConsoleColor.Gray Console.ForegroundColor = ConsoleColor.Gray
Console.BackgroundColor = ConsoleColor.Black Console.BackgroundColor = ConsoleColor.Black
@ -626,6 +634,11 @@
If remaining <> "" Then If remaining <> "" Then
titlestr &= remaining titlestr &= remaining
End If End If
titlestr &= accuracies(0).ToString(" 0.000")
titlestr &= accuracies(3).ToString(" 0.000")
titlestr &= accuracies(6).ToString(" 0.000")
Console.Title = titlestr Console.Title = titlestr
End Sub End Sub
@ -681,6 +694,14 @@
Dim p1rdi As Double = p1.RD Dim p1rdi As Double = p1.RD
Dim p2rdi As Double = p2.RD Dim p2rdi As Double = p2.RD
Dim result As Integer 'red, blue, draw Dim result As Integer 'red, blue, draw
Dim expectedresult As Integer
If p1ki > p2ki Then
expectedresult = 1
ElseIf p2ki > p1ki Then
expectedresult = 2
Else
expectedresult = 3
End If
Console.ForegroundColor = ConsoleColor.Gray Console.ForegroundColor = ConsoleColor.Gray
Console.BackgroundColor = ConsoleColor.Black Console.BackgroundColor = ConsoleColor.Black
If scorestr = "" Then If scorestr = "" Then
@ -799,6 +820,19 @@
Console.Write("{0,4:+###;-###;0}", p2.RD - p2rdi) Console.Write("{0,4:+###;-###;0}", p2.RD - p2rdi)
Console.ForegroundColor = ConsoleColor.Gray Console.ForegroundColor = ConsoleColor.Gray
Console.Write(")" + vbCrLf) Console.Write(")" + vbCrLf)
' Update prediction accuracies
Dim correct As Integer
If result = expectedresult Then
correct = 1
Else
correct = 0
End If
For i = 0 To accuracytimeconstants.Length - 1
Dim exp As Double = Math.Exp(1 / accuracytimeconstants(i))
accuracies(i) = accuracies(i) * (2 - exp) + correct * (exp - 1)
Next
End Sub End Sub
Private Sub DoMatchup(p1 As Glicko, p2 As Glicko, invcolors As Boolean, Optional skip As Boolean = False) Private Sub DoMatchup(p1 As Glicko, p2 As Glicko, invcolors As Boolean, Optional skip As Boolean = False)
@ -898,6 +932,9 @@
Next Next
xd.Add(New XElement("watching", watching.ToString)) xd.Add(New XElement("watching", watching.ToString))
xd.Add(New XElement("autoupdate", autoupdate.ToString)) xd.Add(New XElement("autoupdate", autoupdate.ToString))
For i = 0 To accuracies.Length - 1
xd.Add(New XElement("accuracy" & accuracytimeconstants(i), CStr(accuracies(i))))
Next
xd.Save(dbfilename) xd.Save(dbfilename)
End Sub End Sub
@ -912,15 +949,24 @@
For Each x In xd.<PepperBet>.<name> For Each x In xd.<PepperBet>.<name>
names.Add(x.Value) names.Add(x.Value)
Next Next
Try Try
watching = CBool(xd.<PepperBet>.<watching>.Value) watching = CBool(xd.<PepperBet>.<watching>.Value)
Catch Catch
End Try End Try
Try Try
autoupdate = CBool(xd.<PepperBet>.<autoupdate>.Value) autoupdate = CBool(xd.<PepperBet>.<autoupdate>.Value)
Catch Catch
End Try End Try
Try
For i = 0 To accuracies.Length - 1
accuracies(i) = CDbl(xd.Root.Element("accuracy" & accuracytimeconstants(i)).Value)
Next
Catch
End Try
For Each x In xd.<PepperBet>.<glicko> For Each x In xd.<PepperBet>.<glicko>
Dim temp As New Glicko(x.@name, CLng(x.@lastmatch)) Dim temp As New Glicko(x.@name, CLng(x.@lastmatch))
temp.K = CDbl(x.@k) temp.K = CDbl(x.@k)
@ -1001,6 +1047,7 @@
Console.WriteLine("[Enter/Esc] Enter/exit manual data entry") Console.WriteLine("[Enter/Esc] Enter/exit manual data entry")
Console.WriteLine("[Q]uery database") Console.WriteLine("[Q]uery database")
Console.WriteLine("[C]leanup database") Console.WriteLine("[C]leanup database")
Console.WriteLine("[R]eport accuracy")
Console.WriteLine("[N]ames (for bet watching)") Console.WriteLine("[N]ames (for bet watching)")
Console.WriteLine("[W]atch display toggle") Console.WriteLine("[W]atch display toggle")
Console.WriteLine("[A]utomatic updates toggle") Console.WriteLine("[A]utomatic updates toggle")

View File

@ -1 +1 @@
1.9.12 1.10