Monday Night Algorithm

Monday Night Scoring Algorithm

For the absurdly curious ...

The genuine taken-straight-from-the-program code is shown below, complete with whimsical comments.



float float_max(x, y)
  float x, y;
{
  return (x > y ? x : y);
}


float float_min(x, y)
  float x, y;
{
  return (x < y ? x : y);
}


int sqr(x)
  int x;
{
  return (x * x);
}
  
int monday_current(p1, p2, a1, a2)
  int      p1;    /* predicted score 1 */
  int      p2;    /* predicted score 2 */
  int      a1;    /* actual score 1 */
  int      a2;    /* actual score 2 */
{
/* This algorithm is all magic, handed down from time immemorial.  The
   idea is basically to award the Monday night score based on a standard
   distance formula, but modified to take football stuff into account.
   In particular, (1) a higher score is awarded if you get the point spread
   right; and (2) the "generosity" of the score increases as the actual score
   of the game gets higher under the belief that it's harder to accurately
   predict a high-scoring game than a low-scoring game.
*/
#define HALF   21.0
#define ALPHA   1.6
#define BAT0    3.9
#define BSLOPE  0.048

#define POINTS_FOR_CLOSENESS     80.0
#define BONUS_FOR_PICKING_WINNER 20.0
#define BONUS_FOR_PICKING_TIE    40.0

      float b1 = float_max( 1.1, BAT0 - BSLOPE*(float)(a1) );
      float b2 = float_max( 1.1, BAT0 - BSLOPE*(float)(a2) );

      /* Compute distance -- a modified 2-norm */

      int d1sq = sqr(p1-a1);
      int d2sq = sqr(p2-a2);

      float rsq = (float)(d1sq) + (float)(d2sq);
      float dist = sqrt ( rsq + (float)(sqr((p1-p2)-(a1-a2))) );

      float s, base;

  /* Compute the base -- a weighted average of the bases calculated from 
     the actual scores
  */
      if(rsq == 0.0) {
        s = (a1 == a2 ? 120.0 : 100.0);
      }
      else {
        base = ( (rsq < 0.5) ? 2.0 : ( d1sq*b1 + d2sq*b2 ) / rsq );

        /* s = base ** ( - (dist/HALF)**ALPHA ) * POINTS_FOR_CLOSENESS */
        s = pow(base, ( - pow((dist/HALF), ALPHA) )) * POINTS_FOR_CLOSENESS;

        if  ( (a1 == a2) && (p1 == p2) )  s = s + BONUS_FOR_PICKING_TIE;
        if  ( ((a1 > a2) && (p1 > p2))
                    ||
              ((a1 < a2) && (p1 < p2)) )  s = s + BONUS_FOR_PICKING_WINNER;
      }

    return (int)(s);
}  /* end monday_current */

FBP Home Page Make Picks Standings Getting Started History
FBP Home
Page
Make
Picks
Standings Getting
Started
History

Last updated: 22 Sep 1997
Steve Tolopka
Pool Administrator
tolopka@home.com