Answer the question
In order to leave comments, you need to log in
What is the best way to compare results?
I decided to write a prediction script for football matches, but the problem is, how best to compare the result and the prediction? For example, +1 point for the correct outcome, +2 points for the difference, +3 points for the result, nothing is guessed - 0. Which way to dig, look?
2 0 - forecast
4 2 - result
+2
1 1 - forecast
2 2 - result
+2
2 1 - forecast
0 3 - result
+0
Answer the question
In order to leave comments, you need to log in
Well, what's stopping you from writing switch or if that if the result is a victory, then fulfill such a condition, etc.
you will store in a DB? we make a table of predictions, a table of results and a table of points.
then we do a LEFT JOIN of the result table with the forecast table, JOIN the score table to them - and calculate the total score, grouping by the "forecaster" and the game.
profit
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question