Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm looking to create a comparison and ranking system which allows users to view 2 items, click on the one that they feel is the better one and then get presented with 2 more random items and continue to do this until they decide to stop.

In the background, I want the system to use these wins and loses to rank each item in an overall ranking table so I can then see what is #1 and what isn't.

I haven't got a clue where to begin with the formula, but I image I need to log wins and loses.

Any help/direction appreciated!

share|improve this question
3  
You might want to look at this question on SO. –  Sebastian Paaske Tørholm Aug 8 '12 at 15:33
1  
There's quite a nice explanation of the Elo Rating equation here: onemoredigit.com/post/1327957577/… –  Baqueta Aug 8 '12 at 16:27

2 Answers 2

up vote 5 down vote accepted

Use the Elo algorithm!

From Wikipedia:

The Elo rating system is a method for calculating the relative skill levels of players in two-player games such as chess. It is named after its creator Arpad Elo, a Hungarian-born American physics professor.

It is actually used in many areas, not only games, as you can see here.

The general idea is, each person has a number. The higher the number, the better the player, and vice-versa. The winning person would gain a certain amount of points, and the losing person would lose the same amount of points. This amount is decided by the difference in rating between two competitors. The mathematical details can also be found on Wikipedia.

This sounds to be exactly what you need to implement. Just a couple of notes:

  • Yes, you should log wins-losses.
  • No, you should not keep track of streaks.
share|improve this answer
1  
I was thinking of the Schulze Method or any other Condorcet method instead, but in this particular situation, perhaps the Elo system would do as there's a clean winner and a clean loser on each pair (and it was also used in facebook's origin, facemash) –  Aadaam Aug 13 '12 at 17:37

Maybe I'm over simplifying, but couldn't you just create a new database table called "ranks" foreign-keyed to the item? Then, everytime a rank is set, just run this:

update `rank` set rankUp = rankUp + 1 where rankId = $whateverYourItemIdWouldBe

Then, checking the highest value would be as simple as:

select * from `items` left join `rank` on items.itemId = ranks.itemId order by ranks.rankUp desc
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.