🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #232281

An alternate scoring system for slrn and Google Groups.

#232281
From: Jeffâ–˛Relf
Date: Mon, 06 Apr 2009 21:58
95 lines
5067 bytes
The Cmp() ( for Compare ) I showed you,
― where Cmp() is used in a quickSort, to sort posts ―
could be an alternate scoring system for slrn and Google Groups.

For sorting, each post would have this information:

  A. The catagory it's in, “ Top·0, Middle·1, Bottom·2 ”.
     “ Top ” has replies to the user,
     “ Bottom ” has posts the user made “ ― the rest are in “ Middle ”.

  B. Information about the nym who made the post, to wit:
     1. His count of unRead posts, “ cnt·unReads ”.
     2. His xRank ( a 64 bit float ), based on who replied to him.
     3. How long ago he last posted, “ DaysAgoLatest ”.
     
  C. How old the post is, “ AgeDays ”.
  
  D. A boolean, to know if the post was read or not, “ wasRead ”.
     ( No nym has more than 30 wasRead posts.
       nonWatched nyms are muffled,
       so no more than the 3 most-recent are unRead )
     
>From “ www.JeffRelf.F-M.FM/X.CPP ”, in Visual C++ 9:
[ Note the “ 7 nested return statements,
             each returning something special ” ]

//  “ Case ” is the post that's being scored;
//  “ Vs ” is the post  Case  is being compared against.
//  Lower numbers ( e.g. larger negative numbers )
//  come first, at the top of the list.
inline double Cmp( LsP  Case, LsP  Vs ) {

  //  There are 3 Catagories ( Cat ): “ Top·0, Middle·1, Bottom·2 ”.
  //  “ Top ” has replies to me, “ Bottom ” has posts I made;
  //  the rest are in “ Middle ”.
  if ( Case->Cat != Vs->Cat )
    //  “ Case ” goes up the list ( e.g. has a larger negative number )
    //  when “ Vs ” has a higher “ Cat ”.
    return  Case->Cat - Vs->Cat ;
    
  NymT & caseNym = * Case->Nym, & vsNym = * Vs->Nym ;
  if ( Case->Cat == Cat_Mid && & caseNym != & vsNym ) {
    //  Both Case and Vs are in Cat_Mid and
    //  they don't have the same nym.
    
    if ( !vsNym.cnt·unReads != !caseNym.cnt·unReads )
      //  Case goes up the list when
      //  caseNym has unReads and vsNym doesn't.
      return  !caseNym.cnt·unReads - !vsNym.cnt·unReads ;

    if ( caseNym.xRank == vsNym.xRank )

      //  caseNym and vsNym have the same xRank.
      //  Case goes up the list when vsNym hasn't posted as recently.
    
      //  This groups posts by nym because
      //  no two nyms have the same xRank  And  the same DaysAgoLatest.
      //  DaysAgoLatest is a float with a one second resolution.
      return  caseNym.DaysAgoLatest - vsNym.DaysAgoLatest ;
      
    //  Case goes up when caseNym has a higher xRank.
    return  vsNym.xRank - caseNym.xRank ;
  }
  
  if ( Case->Cat == Cat_Bot )

    //  Case and Vs are in Cat_Bot ( i.e. they're posts I've made ).
    //  Sort by oldest first,
    //  so my most recent post is at the very bottom.

    //  Case goes up when it's older.
    return Vs->AgeDays - Case->AgeDays ;
    
  //  Case and Vs either “ have the same nym and are in Cat_Mid ”
  //  or they're both in Cat_Top, possibly with differnt nyms.

  if ( Case->wasRead != Vs->wasRead )

    //  Both posts are in Cat_Mid, with the same nym,
    //  because Cat_Top has no wasRead posts.
    //  Case goes up when it's unRead and Vs isn't.
    return  Case->wasRead - Vs->wasRead ;
    
  //  Sort by youngest first, Case goes up when Vs is older.
  return  Case->AgeDays - Vs->AgeDays ;  }

//  This “ Quick Sorts ” posts using Cmp() ( above ).
ByCatxRankNymVistdAge( LsA _B,  LsA _E ) {  if ( _E <= _B ) return;
  LsA  BB = _B - 1, EE = _E + 1 ;  LsP  Std = _B [ ( _E - _B ) / 2 ] ;
  LOOP {
    while ( Cmp( * ++ BB , Std ) < 0. );
    while ( EE >= BB && Cmp( * -- EE , Std ) > 0. );
    if ( EE <= BB ) break;  LsP T = * BB ; * BB = * EE ; * EE = T ;  }
  ByCatxRankNymVistdAge ( _B, EE < _E ? EE : -- EE );  
  ByCatxRankNymVistdAge ( EE + 1, _E ); }
Technical Details
Message-ID: <Jeff_Relf@Seattle.2009_Apr.6|2.58pm|s>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <Jeff_Relf@Seattle.2009_Apr.5|8.18am|h> <slrngthmb3.83q.catwheezel@ID-107770.user.individual.net> <Jeff_Relf@Seattle.2009_Apr.5|1.38pm|a> <slrngtkgm5.bab.catwheezel@ID-107770.user.individual.net> <Jeff_Relf@Seattle.2009_Apr.6|0.52pm|a> <slrngtkquf.bab.catwheezel@ID-107770.user.individual.net>

Show Full Headers
Complete Article Headers
Message-ID: <Jeff_Relf@Seattle.2009_Apr.6|2.58pm|s>
Subject: An alternate scoring system for slrn and Google Groups.
Date: Mon, 06 Apr 2009 21:58:52 +0000
From: Jeffâ–˛Relf <Jeff_Relf@Seattle.inValid>
References: <Jeff_Relf@Seattle.2009_Apr.5|8.18am|h> <slrngthmb3.83q.catwheezel@ID-107770.user.individual.net> <Jeff_Relf@Seattle.2009_Apr.5|1.38pm|a> <slrngtkgm5.bab.catwheezel@ID-107770.user.individual.net> <Jeff_Relf@Seattle.2009_Apr.6|0.52pm|a> <slrngtkquf.bab.catwheezel@ID-107770.user.individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Lines: 95
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net ys7kmQmF1LCcqWxhabw8CQxIbsc4kORGG8T5+uX1HtuWDz8koV
Cancel-Lock: sha1:lHMu9xMPdcPABINPIioFn0hV2NI=
User-Agent: JeffRelf.F-M.FM/X.ZIP