Page 1 of 2
Obtaining user's rank
Posted: Tue Sep 23, 2014 4:37 pm
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.
Re: Obtaining user's rank
Posted: Tue Sep 23, 2014 5:36 pm
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=ellysterIf there are no games for the current month you can try:
http://www.gokgs.com/gameArchives.jsp?u ... 14&month=8until you find the last game.
Re: Obtaining user's rank
Posted: Tue Sep 23, 2014 5:54 pm
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...
Re: Obtaining user's rank
Posted: Wed Sep 24, 2014 1:11 pm
by xed_over
Re: Obtaining user's rank
Posted: Wed Sep 24, 2014 6:21 pm
by DrStraw
Is it possible to read information from the rank graph with a program?
Re: Obtaining user's rank
Posted: Thu Sep 25, 2014 12:12 am
by Uberdude
I'm sure it's
possible with OCR (Optical Character Recognition) but certainly more convoluted and difficult. Today's
xkcd is apt.

Re: Obtaining user's rank
Posted: Thu Sep 25, 2014 4:47 am
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.
Re: Obtaining user's rank
Posted: Thu Sep 25, 2014 5:08 am
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.
Re: Obtaining user's rank
Posted: Thu Sep 25, 2014 5:12 am
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?

Re: Obtaining user's rank
Posted: Thu Sep 25, 2014 6:51 am
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.
Re: Obtaining user's rank
Posted: Thu Sep 25, 2014 2:32 pm
by cobrahc
Hi There,
I just had some free time and I did this.
https://bitbucket.org/wendelbsilva/kgs-data/overviewIts 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.
Re: Obtaining user's rank
Posted: Thu Sep 25, 2014 11:56 pm
by Mef
cobrahc wrote:Hi There,
I just had some free time and I did this.
https://bitbucket.org/wendelbsilva/kgs-data/overviewIts 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)
Re: Obtaining user's rank
Posted: Fri Sep 26, 2014 10:08 am
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?

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).
Re: Obtaining user's rank
Posted: Fri Sep 26, 2014 10:32 am
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.
Re: Obtaining user's rank
Posted: Fri Sep 26, 2014 11:19 am
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...

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/