|
|
| Chess Rating Algorithm |
|
ImLeftFooted
Member #3,935
October 2003
|
Due to an interesting turn of events, I need to calculate someones chess rating. So far I've found this description of the offical formula. http://math.bu.edu/people/mg/ratings/rs/node1.html Does anyone have any previous experience with this or know of somewhere I can rip code from? |
|
Evert
Member #794
November 2000
|
Ah, somehow I thought you were looking for a way to rate chess positions (for a chess program), which I do have some direct experience with. sorry I couldn't be more helpful... |
|
ImLeftFooted
Member #3,935
October 2003
|
Here's what I've put together based on this article: int rating; int opponentRating; float score = 0; if(win) score = 1; if(draw) score = .5f; rating = round(rating + 32 * (score - 1 / (1.0f + 10 * (otherRating - rating) / 400.0f))); (This assumes a K value of 32, which is typically only used for novice games. GM games and above use K values of 10 or so. See [1]) Evert said: Ah, somehow I thought you were looking for a way to rate chess positions (for a chess program), which I do have some direct experience with. I am also very curious about that. How much time would it take me to make a decent chess program? How do I rate a chess position? |
|
Evert
Member #794
November 2000
|
Dustin Dettmer said: (This assumes a K value of 32, which is typically only used for novice games. GM games and above use K values of 10 or so. See [1]) The K value should depend on the number of rated games; it's higher if there are fewer games that have been rated (which is typically the case for novice players, of course). Quote: I am also very curious about that. How much time would it take me to make a decent chess program? How do I rate a chess position?
Writing a chess program isn't actually that hard, but writing one that plays decently... meh. I don't think I've succeeded in doing that. Do a google for "minimax" or "alpha-beta algorithm" if you want to work out the details. Damn, now you've made me want to write a chess program again. |
|
Inphernic
Member #1,111
March 2001
|
Evert said: (for instance, to generate all possible pawn moves, take a "bit board" representing pawn positions for a particular player, shift it by one row and do a logical and with a bitboard that represents all empty squares; now you just read off the non-zero bits to find possible pawn destinations) You'd also have to take into account en passant and that pawns can move two squares on their first move. -- |
|
Evert
Member #794
November 2000
|
Inphernic said: You'd also have to take into account en passant and that pawns can move two squares on their first move.
You did realise you were stating the obvious, right? |
|
Inphernic
Member #1,111
March 2001
|
Evert said: You did realise you were stating the obvious, right? To all chess players, sure, just like offside rules in American football are obvious to those who are familiar with them. In my experience, many casual players (even good ones) are not aware of en passant. There should be no harm done in saying that implementing method X for generating all possible pawn moves doesn't quite generate all possible pawn moves, whether Dustin is familiar with the move or not. -- |
|
|