Obtaining user's rank

Comments, questions, rants, etc, that are specifically about KGS go here.
Ellyster
Dies in gote
Posts: 62
Joined: Thu Jun 21, 2012 12:32 pm
Rank: KGS 3 kyu
GD Posts: 0
KGS: Ellyster
Location: Granada, Spain | Osaka, Japan | Turku, Finland | Tokyo, Japan
Has thanked: 50 times
Been thanked: 22 times
Contact:

Obtaining user's rank

Post by Ellyster »

Is there any way to get the rank of user knowing their users name? (similarly to their rank graph)

I'm developing a website, I would like to use the KGS rank of the user to tune the contents that they get (show the ones more interesting for their level). But I don't know if obtaining the rank from KGS by code would be easy... right now the only solution that I see is to download their last game and extract it from there... but it seems quite an inefficient method.
DrStraw
Oza
Posts: 2180
Joined: Tue Apr 27, 2010 4:09 am
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Has thanked: 237 times
Been thanked: 662 times
Contact:

Re: Obtaining user's rank

Post by DrStraw »

The archive page has there games for the current month and it displays their rank in their last game. Try:

http://www.gokgs.com/gameArchives.jsp?user=ellyster

If there are no games for the current month you can try:

http://www.gokgs.com/gameArchives.jsp?u ... 14&month=8

until you find the last game.
Still officially AGA 5d but I play so irregularly these days that I am probably only 3d or 4d over the board (but hopefully still 5d in terms of knowledge, theory and the ability to contribute).
Mef
Lives in sente
Posts: 852
Joined: Fri Apr 23, 2010 8:34 am
Rank: KGS [-]
GD Posts: 428
Location: Central Coast
Has thanked: 201 times
Been thanked: 333 times

Re: Obtaining user's rank

Post by Mef »

The rank graph is probably the closest thing available to what you are looking for. It seems to me though of you are tuning website content, it might be easier / more desirable to have the users simply self report a rank. I suppose this has the drawback of not auto updating though...
xed_over
Oza
Posts: 2264
Joined: Mon Apr 19, 2010 11:51 am
Has thanked: 1179 times
Been thanked: 553 times

Re: Obtaining user's rank

Post by xed_over »

DrStraw wrote:The archive page has there games for the current month and it displays their rank in their last game. Try:

http://www.gokgs.com/gameArchives.jsp?user=ellyster

If there are no games for the current month you can try:

http://www.gokgs.com/gameArchives.jsp?u ... 14&month=8

until you find the last game.


or just their rank graph

http://www.gokgs.com/graphPage.jsp?user=ellyster
DrStraw
Oza
Posts: 2180
Joined: Tue Apr 27, 2010 4:09 am
Rank: AGA 5d
GD Posts: 4312
Online playing schedule: Every tenth February 29th from 20:00-20:01 (if time permits)
Location: ʍoquıɐɹ ǝɥʇ ɹǝʌo 'ǝɹǝɥʍǝɯos
Has thanked: 237 times
Been thanked: 662 times
Contact:

Re: Obtaining user's rank

Post by DrStraw »

xed_over wrote:
or just their rank graph

http://www.gokgs.com/graphPage.jsp?user=ellyster


Is it possible to read information from the rank graph with a program?
Still officially AGA 5d but I play so irregularly these days that I am probably only 3d or 4d over the board (but hopefully still 5d in terms of knowledge, theory and the ability to contribute).
Uberdude
Judan
Posts: 6727
Joined: Thu Nov 24, 2011 11:35 am
Rank: UK 4 dan
GD Posts: 0
KGS: Uberdude 4d
OGS: Uberdude 7d
Location: Cambridge, UK
Has thanked: 436 times
Been thanked: 3718 times

Re: Obtaining user's rank

Post by Uberdude »

I'm sure it's possible with OCR (Optical Character Recognition) but certainly more convoluted and difficult. Today's xkcd is apt. ;-)
Mef
Lives in sente
Posts: 852
Joined: Fri Apr 23, 2010 8:34 am
Rank: KGS [-]
GD Posts: 428
Location: Central Coast
Has thanked: 201 times
Been thanked: 333 times

Re: Obtaining user's rank

Post by Mef »

Uberdude wrote:I'm sure it's possible with OCR (Optical Character Recognition) but certainly more convoluted and difficult. Today's xkcd is apt. ;-)



Actually, for something like the kgs rank graph I would think it shouldn't be a terribly convoluted process. Well defined shapes and colors, I vaguely recall doing image processing stuff like this in an introductory Matlab course.
Uberdude
Judan
Posts: 6727
Joined: Thu Nov 24, 2011 11:35 am
Rank: UK 4 dan
GD Posts: 0
KGS: Uberdude 4d
OGS: Uberdude 7d
Location: Cambridge, UK
Has thanked: 436 times
Been thanked: 3718 times

Re: Obtaining user's rank

Post by Uberdude »

I didn't mean it was 5 years and a research team convuluted, but it's certainly more complicated than a regex or a few ifs and strstrs.
User avatar
ez4u
Oza
Posts: 2414
Joined: Wed Feb 23, 2011 10:15 pm
Rank: Jp 6 dan
GD Posts: 0
KGS: ez4u
Location: Tokyo, Japan
Has thanked: 2351 times
Been thanked: 1332 times

Re: Obtaining user's rank

Post by ez4u »

What kind of site are you planning that will be visited mainly by KGS players where you would not request/trust their self-reported rank but will request, receive, and then trust their self-reported username?
:scratch:
Dave Sigaty
"Short-lived are both the praiser and the praised, and rememberer and the remembered..."
- Marcus Aurelius; Meditations, VIII 21
Mef
Lives in sente
Posts: 852
Joined: Fri Apr 23, 2010 8:34 am
Rank: KGS [-]
GD Posts: 428
Location: Central Coast
Has thanked: 201 times
Been thanked: 333 times

Re: Obtaining user's rank

Post by Mef »

Uberdude wrote:I didn't mean it was 5 years and a research team convuluted, but it's certainly more complicated than a regex or a few ifs and strstrs.


Actually, it might not be terribly more complicated than that....if you convert the png to a bitmap all you need to do is find the green pixels to get the coordinates of a raw graph. A similar type search could be used to figure out the horizontal graph divisions. This would more or less give you the fractional component of a rank at any time. The numbers for the ranks themselves can be found from the archive game list.
User avatar
cobrahc
Dies in gote
Posts: 51
Joined: Wed Sep 24, 2014 10:54 am
Rank: IGS 9k
GD Posts: 0
Universal go server handle: cobrahc
Has thanked: 27 times
Been thanked: 2 times

Re: Obtaining user's rank

Post by cobrahc »

Hi There,

I just had some free time and I did this.

https://bitbucket.org/wendelbsilva/kgs-data/overview

Its almost like Mef suggested. Right now its only getting the rank from the graph (and plotting it again).
I didnt had a lot of time free, so the code is 'ugly' and 'slow'. If I have some free time later I will fix those issues and add more stuff. My next step would be to identify the date range.

Language: Python
Libraries used:
> PyPandas: To read tables from HTML
> OpenCV: To play with the image and if needed later, do any image processing needed
> PyLab: To plot the data.
Mef
Lives in sente
Posts: 852
Joined: Fri Apr 23, 2010 8:34 am
Rank: KGS [-]
GD Posts: 428
Location: Central Coast
Has thanked: 201 times
Been thanked: 333 times

Re: Obtaining user's rank

Post by Mef »

cobrahc wrote:Hi There,

I just had some free time and I did this.

https://bitbucket.org/wendelbsilva/kgs-data/overview

Its almost like Mef suggested. Right now its only getting the rank from the graph (and plotting it again).
I didnt had a lot of time free, so the code is 'ugly' and 'slow'. If I have some free time later I will fix those issues and add more stuff. My next step would be to identify the date range.

Language: Python
Libraries used:
> PyPandas: To read tables from HTML
> OpenCV: To play with the image and if needed later, do any image processing needed
> PyLab: To plot the data.



Nice!

To come back to Uberdude's comic, I think the go equivalent would be something like this:

"Let's have the app where users submit a picture of their go board, and convert the position to sgf..."

(Non-trivial, but not impossible)

"...then respond back to them with the best move to play in that position..."

(Decades of CS research)
Ellyster
Dies in gote
Posts: 62
Joined: Thu Jun 21, 2012 12:32 pm
Rank: KGS 3 kyu
GD Posts: 0
KGS: Ellyster
Location: Granada, Spain | Osaka, Japan | Turku, Finland | Tokyo, Japan
Has thanked: 50 times
Been thanked: 22 times
Contact:

Re: Obtaining user's rank

Post by Ellyster »

ez4u wrote:What kind of site are you planning that will be visited mainly by KGS players where you would not request/trust their self-reported rank but will request, receive, and then trust their self-reported username? :scratch:


Is not about the trust in the user, is about having the rank always up-to-date without being a pain in the ass to the user, that way the content can change smoothly with the learning pace.

cobrahc wrote:https://bitbucket.org/wendelbsilva/kgs-data/overview

In the worst case I was planning in doing the same, but checking with your code, it seems that parsing the HTML page is quite slow and resource consuming, so I will probably not add that functionality at the end.

And is not only being too slow for being used in a webpage, also I really don't like the idea of being constantly crawling the KGS archives, it may affect the performance of the server :(.

BTW, your code fails if the user has no recent (this month) played game (it would need to search and parse backwards each month until it finds a game).



I wonder if wms will implement that functionality at some point (since is really simple), lots of places would benefit from that... for example L19 or the ASR webpage (they have an open issue about it in GitHub).
User avatar
cobrahc
Dies in gote
Posts: 51
Joined: Wed Sep 24, 2014 10:54 am
Rank: IGS 9k
GD Posts: 0
Universal go server handle: cobrahc
Has thanked: 27 times
Been thanked: 2 times

Re: Obtaining user's rank

Post by cobrahc »

You are correct. My code is slow and doesnt work in a lot of cases. Not only that, it may burden the server.
What I want for the near future is to get a list of players(anonymously) with their progress so I can do some analytics. I need to think how to do that in slowly (to not burden the server) and in batch mode.

Anyway, Im only playing with this code during my breaks, so its going to take some time before I have it in the way I would like to.

Would be nice if KGS and/or others servers had some kind of API where we could get historical data (maybe) or only even the rank of a given player.
Uberdude
Judan
Posts: 6727
Joined: Thu Nov 24, 2011 11:35 am
Rank: UK 4 dan
GD Posts: 0
KGS: Uberdude 4d
OGS: Uberdude 7d
Location: Cambridge, UK
Has thanked: 436 times
Been thanked: 3718 times

Re: Obtaining user's rank

Post by Uberdude »

Ellyster wrote:I wonder if wms will implement that functionality at some point (since is really simple), lots of places would benefit from that...


:lol: :lol: The stone click sound is also really simple, far bigger negative impact, and hasn't been fixed for years. So I'll bet on a no.

cobrahc wrote:
Would be nice if KGS and/or others servers had some kind of API where we could get historical data (maybe) or only even the rank of a given player.


http://online-go.com/api/ and http://docs.ogs.apiary.io/
Post Reply