Sigi_BC84 Posted March 5, 2006 Report Share Posted March 5, 2006 COPYRIGHT 2006 - Todd A. AndersonNo 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 Quote Link to comment Share on other sites More sharing options...
Brandal Posted March 7, 2006 Report Share Posted March 7, 2006 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? Quote Link to comment Share on other sites More sharing options...
EarlPurple Posted March 13, 2006 Report Share Posted March 13, 2006 COPYRIGHT 2006 - Todd A. AndersonNo 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 ascale of 0 to 10 and ratings weight maxes out after 20 boards but as youcan 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 ? Quote Link to comment Share on other sites More sharing options...
Sigi_BC84 Posted March 13, 2006 Report Share Posted March 13, 2006 Hey, it's getting interesting. 4. I hate K&R bracing style.Blasphemy. What do you use (please don't say GNU style)? 5. cout - is this a console app?Yes. --Sigi Quote Link to comment Share on other sites More sharing options...
EarlPurple Posted March 13, 2006 Report Share Posted March 13, 2006 I use block-style bracing, thank you. Makes the code nice and clear to read. The only exception where I use K&R is opening a namespace, and that's because I generally don't indent either. Quote Link to comment Share on other sites More sharing options...
jdulmage Posted March 15, 2006 Report Share Posted March 15, 2006 Nobody takes ranking seriously online anyway. People rank themselves experts, but are no better than my local newcomers. Quote Link to comment Share on other sites More sharing options...
Sigi_BC84 Posted March 17, 2006 Report Share Posted March 17, 2006 6. Ever heard of std::for_each ?After wondering for a few days why you would want to use for_each() in this case, I can only say that I find no reason to do so. It would only make the code less readable and maintainable. See also: http://www.awprofessional.com/articles/art...345948&seqNum=3 --Sigi Quote Link to comment Share on other sites More sharing options...
DrTodd13 Posted March 17, 2006 Report Share Posted March 17, 2006 I totally agree. I don't like for_each because it makes the code look ugly. Quote Link to comment Share on other sites More sharing options...
igormally Posted April 5, 2006 Report Share Posted April 5, 2006 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. Quote Link to comment Share on other sites More sharing options...
pigpenz Posted April 5, 2006 Report Share Posted April 5, 2006 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: Quote Link to comment Share on other sites More sharing options...
Codo Posted April 10, 2006 Report Share Posted April 10, 2006 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. Quote Link to comment Share on other sites More sharing options...
bradd Posted April 13, 2006 Report Share Posted April 13, 2006 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. Quote Link to comment Share on other sites More sharing options...
zasanya Posted April 15, 2006 Report Share Posted April 15, 2006 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. :) Quote Link to comment Share on other sites More sharing options...
igormally Posted April 15, 2006 Report Share Posted April 15, 2006 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. Quote Link to comment Share on other sites More sharing options...
hotShot Posted April 15, 2006 Report Share Posted April 15, 2006 Well chess is an individual sport, rating is much simpler there.Compare this with rating in e.g. the NHL.I wonder how many goals and assist points a goalie usually gets, i bet almost everybody in the defence and the offence has a better rating. Quote Link to comment Share on other sites More sharing options...
arrows Posted April 18, 2006 Report Share Posted April 18, 2006 add more levels: Galaxy classUniverse classHoly God just my 2 cents. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.