kraln / schickenbot

Ceresbot Clone for Twitch Streamer Kottpower
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Feature Request:Reward points based on probability #1

Open kotenku opened 7 years ago

kotenku commented 7 years ago

By recording a streamer's ceres times, it's possible to calculate an average and standard deviation. Using that information, the bot can reward points to correct guessers based on how likely their guess was to be correct.

If we also reward points to first second and third place guesses, we can represent the place by N: Within one standard deviation: N1 (68% of all runs will fall within this range) 2: N2 (27.2% of runs will fall outside of the first standard deviation and inside the second) 3: N4 (4.2%); for a perfect guess, this would be 5004 = 2000, for close but incorrect guesses, this would be 200, 60, 20 points 4: N*8 (0.2%) = 4000 points and 400,120,40 for first,second,third place guesses.

kraln commented 7 years ago

That's uh, wow. It looks awesome but I don't really know where to begin with it. I was planning on adding more statistics at a later point (why everything is stored in sqlite). Maybe pull request? it will affect round_end and award_points, likely.

kotenku commented 7 years ago

Unfortunately I'm not very familiar with C#, so I'm not prepared to make a pull request, but this should do the job to start with: 1: When !endceres is run, convert the argument to a double: "4566" => 45.66, and put it in a column of the stats table. 2: When stats() is run, pull the contents of that column into a table, and calculate the standard deviation: http://stackoverflow.com/questions/5336457/how-to-calculate-a-standard-deviation-array 3: When award_points is called, pass in the standard deviation. Calculate the ranges. Might look like this:

//within one stddev:
low1 = avg - stddev
high1 = avg + stddev
//within two stddev:
low2 = avg - (2*stddev)
high2 = avg + (2*stddev)
//and so on for third and fourth standard deviations. Then to calculate which a guess fell under, you do:
if (guess > low 1 and guess < high1)
  multiplier = 1
else if (guess > low2 and guess <low1) OR (guess > high1 and guess < high2)
  multiplier = 2
//and so on
//then modify award_points. Around line 230 (just after switch(place) terminates):
new_points = new_points * multiplier

Some extra logic to make sure there's a reasonable sample size ( eg count(CeresTimes) > 10 ) before bothering to calculate the standard deviation at all might be advisable.

kraln commented 7 years ago

Don't worry so much about C#, do you know any SQL? The data is all stored in SQLlite, which means any stats processing would need to be done there.

kraln commented 7 years ago

I really appreciate your feature request, by the way. I'd love to make this the best possible ceres bot ;)

kraln commented 7 years ago

Maybe helpful: http://stackoverflow.com/questions/2298339/standard-deviation-for-sqlite