Jump to content

New Player Definitions


Winstonm

Recommended Posts

COPYRIGHT 2006 - Todd A. Anderson

No permission to use this code or the ideas embodied herein unless specifically granted by the author.

No offense Todd, but I don't think it's legally possible to restrain anybody from using ideas you have published unless you have a patent on these ideas. Furthermore, software ideas are not patentable everywhere (e.g. not in Europe, fortunately).

 

--Sigi

Link to comment
Share on other sites

  • Replies 140
  • Created
  • Last Reply

Top Posters In This Topic

So let me get this straight, there is some jerk on BBO that nobody would want to play with or against. Your "efficient" method is for everyone on BBO to play with this jerk, then realize he is a jerk, then mark him as an enemy? It seems a lot more efficient to me for 5 or 10 poor souls to have to suffer through the jerk and be able to tell the rest of us "watch our for the jerk."

Hi Todd

 

I've been debating the skill part,or at least think I have,mostly :)

 

I don't play with pickup partners much,but to answer your question,

yes that's my efficient system :blink:

 

-----------------

 

I'm still trying to get my head around the skill system of yours.

 

Will a vote have less weight if the player voting has lower skill level?

Link to comment
Share on other sites

COPYRIGHT 2006 - Todd A. Anderson

No permission to use this code or the ideas embodied herein unless specifically granted by the author.

------------------------------------------------------------------------

 

The main function of interest is "ComputeReputations."  Ratings are on a

scale of 0 to 10 and ratings weight maxes out after 20 boards but as you

can see this is a configurable parameter.

--------------------------------------------------------------------

#define MIN_RATING 0
#define MAX_RATING 10
#define MIN_BOARDS 1
#define MAX_BOARDS 20

using namespace std;

class Evaluation {
protected:
   unsigned int m_num_boards;
   unsigned int m_num_days_since_epoch;
   unsigned int m_skill;
   unsigned int m_niceness;
public:
   Evaluation(void) {}
   Evaluation(unsigned int num_boards,unsigned int days_since_epoch) :
       m_num_boards(num_boards), m_num_days_since_epoch(days_since_epoch), m_sk
ill(UINT_MAX), m_niceness(UINT_MAX) {}
   void AddBoards(unsigned int num_boards,unsigned int days_since_epoch) {
       // prevent wrap-around
       if(m_num_boards + num_boards > m_num_boards) m_num_boards += num_boards;
       m_num_days_since_epoch = days_since_epoch;
   }
   void NewEvaluation(unsigned int skill,unsigned int niceness);

   unsigned int get_num_boards(void) const { return m_num_boards; }
   unsigned int get_days_since_epoch(void) const { return m_num_days_since_epoc
h; }
   unsigned int get_skill(void) const { return m_skill; }
   unsigned int get_niceness(void) const { return m_niceness; }
};

class Reputation {
protected:
   map<string,Evaluation> m_evals;
   double time_weight(unsigned int x) const;
public:
   void AddBoards(const string &username,unsigned int num_boards,unsigned int d
ays_since_epoch);
   // 0 = success
   // 1 = parameter out of range
   // 2 = no boards played
   int NewEvaluation(const string &username,unsigned int skill,unsigned int nic
eness);

   void ComputeReputations(unsigned int days_since_epoch,float &skill_reputatio
n,float &niceness_reputation) const;
};

void Reputation::AddBoards(const string &username,unsigned int num_boards,unsign
ed int days_since_epoch) {
   map<string,Evaluation>::iterator eval_iter = m_evals.find(username);
   if(eval_iter == m_evals.end()) {
       m_evals.insert(pair<string,Evaluation>(username,Evaluation(num_boards,da
ys_since_epoch)));
   } else {
       eval_iter->second.AddBoards(num_boards,days_since_epoch);
   }
}

void Evaluation::NewEvaluation(unsigned int skill,unsigned int niceness) {
   m_skill                = skill;
   m_niceness             = niceness;
}

int Reputation::NewEvaluation(const string &username,unsigned int skill,unsigned
int niceness) {
   if(skill < MIN_RATING || skill > MAX_RATING || niceness < MIN_RATING || nice
ness > MAX_RATING) return 1;

   map<string,Evaluation>::iterator eval_iter = m_evals.find(username);
   if(eval_iter == m_evals.end()) {
       return 2;
   } else {
       eval_iter->second.NewEvaluation(skill,niceness);
   }

   return 0;
}

// This is something else I haven't already mentioned.
// Ratings degrade in weight over time.  If you played with someone
// a year ago then your rating counts less than someone who played
// with them 2 days ago.  There is a lot of time for improvement over
// a year but not 2 days.  The following piecewise formula is complex
// but basically it is relatively flat for up to 80 days and then drops
// pretty linearly for another 80 days and then has a relatively long
// flat tail.
double Reputation::time_weight(unsigned int x) const {
   double val;
   if(x<120) {
       val = 1.5 - 0.5 * exp(x*x/20775.0);
   }
   else {
       val = 0.5 * exp((x-120)/-173.0);
   }
   return val;
}

void Reputation::ComputeReputations(unsigned int days_since_epoch,float &skill_r
eputation,float &niceness_reputation) const {
   map<string,Evaluation>::const_iterator eval_iter;
   double sum_skill    = 0.0;
   double sum_niceness = 0.0;
   double sum_weight   = 0.0;

   cout << "ComputeReputations" << endl;
   for(eval_iter  = m_evals.begin();
       eval_iter != m_evals.end();
       ++eval_iter) {
       unsigned int num_boards = eval_iter->second.get_num_boards();
       num_boards = num_boards > MAX_BOARDS ? MAX_BOARDS : num_boards;
       cout << "ComputeReputations " << num_boards << endl;
       if(num_boards >= MIN_BOARDS) {
           double weight = time_weight(days_since_epoch - eval_iter->second.get
_days_since_epoch()) * (num_boards / MAX_BOARDS);
           sum_skill    += weight * eval_iter->second.get_skill();
           sum_niceness += weight * eval_iter->second.get_niceness();
           sum_weight   += weight;
       }
   }
   if(sum_weight == 0.0) {
       skill_reputation    = -1.0;
       niceness_reputation = -1.0;
   } else {
       skill_reputation    = sum_skill    / sum_weight;
       niceness_reputation = sum_niceness / sum_weight;
   }
}

1. Use enums or const ints inside a namespace, not #defines.

2. Don't put using namespace std in a header file. (Although you've put all the implementation into the one file and I see no file-scope guards).

3. Member variables should be private, not protected. (As you don't have virtual destructors you're not going to derive from these classes anyway).

4. I hate K&R bracing style.

5. cout - is this a console app?

6. Ever heard of std::for_each ?

Link to comment
Share on other sites

  • 3 weeks later...

Has anyone ever considered creating an ELO rating system for bridge similar to that used in chess ?

 

Some info here http://en.wikipedia.org/wiki/Elo_rating_system

 

There are more variables to consider but I would have thought some such system could be built particularly for an online environment where all the comparison data is readily available.

Link to comment
Share on other sites

having never played on OKBridge, why is it that people dont like their rating system?

Steve Picketts Bridgebrowser gives ratings for players on BBO also its just not public. It interesting when you see peoples ratings and from what i have seen they tend to be right on from what i have seen :ph34r:

Link to comment
Share on other sites

People don?t like their rating system, because any systems tends to show, that you are worse then you believe you are.

This happens with ELo in chess (I had been better, but bad luck, bla bla bla) and to the ok-bridge system. (I played too many pickup parts/late at night/with too good/too bad opponents, Too good/too bad parts..)

 

I liked the system, because it was- besides all flaws- better then anything else.

Link to comment
Share on other sites

I can't remember where, but I came across a self rating system, which didn't have selectable options - you just input anything you liked. So, for instance, one (that I thought quite cute), was "watchable".

 

Obviously this is open to abuse, but I think most people would welcome the opportunity to enter something original and descriptive (and maybe amusing) for their skill level, rather than a pre-determined set of responses.

Link to comment
Share on other sites

People don?t like their rating system, because any systems tends to show, that you are worse then you believe you are.

This happens with ELo in chess (I had been better, but bad luck, bla bla bla)

Beg to differ.There is no luck in chess.ELO rating gives an accurate description of an active players skill level.Moreover in chess if anyone claims he/she is better then all you have to do is to play a few games with each other.

In bridge even 100 deals will not prove anything if the lesser player doesn't keep an open mind.

Last but not the least the ' unit' to be examined in bridge should be a pair and not a player.Wonder if Meck or Well would have an expert performance if I am the partner. :)

Link to comment
Share on other sites

In my experience there is very little dispute in chess about ratings. It is the accepted measure of any player's skill. The other widely used measures are the titles such as International Master or Grandmaster and ratings are also the basis for gaining one of these titles.

 

Those titles are awarded based on achieving a minimum result in several tournaments. The minimum result needed is calculated based on the strength of the opposition as determined by the ratings of the opponents.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...