Bug with match team board endpoint? (Tricky situation, bug and/or I'm confused!)

Sort:
skelos

Hi,

I'm using the per-board team match URL:

https://api.chess.com/pub/match/876452/13

That's a tricky example, as both players were closed for fair play violations.

The returned data begins:

{"board_scores":{"nmarvel":1,"bishop_ate":1}, ...

That's all well and good, but:

1. The match from which this example comes is Oracle "team1" vs Canichess Alumni "team2" but the order has been reversed, as @bishop_ate was playing for Oracle and @nmarvel for Canichess Alumni (and <your favourite programming language>'s JSON support might or might not preserve order anyway)

2. If the two teams both clean out closed accounts then a lookup of their current team members will find neither name [Edit: closed accounts don't show in team member lists via api.chess.com, so this point is moot. ]

3. The solution should be to ignore "board_result" and look at the individual games, each of which is specified to include a "team" url for each player so that I know who belonged (or maybe belongs, but I don't want to care about "now", I care about when the match was started) just as the documentation says:

https://www.chess.com/news/view/published-data-api#pubapi-endpoint-match-board

    "games": [
        {
             "white": { // details of the white-piece player:
               "username": "string", // the username
               "rating": 1492, // the player's rating at the start of the game
               "result": "string", // if game's finished, see "Game results codes" section
               "@id": "string", // URL of this player's profile
               "team": "url" // url to club's profile
              },
...

Unfortunately, I'm not seeing the "team" included:

..."white":{"rating":1919,"result":"timeout","@id":"https://api.chess.com/pub/player/nmarvel","username":"NMarvel"},...

I can't tell about Canichess Alumni and @NMarvel, but I am an admin in Oracle and it appears that @Bishop_ate has been purged from the list of closed accounts.

 

Now I'm kinda stuck: the website can tell who played for which team, provide links to the games with the actual result, show the chess.com adjusted result in the match page ... but some of that data I don't see how to get to.

 

Background (may/may not help):

I am writing a script to score TMCL matches. TMCL has a cutoff date; before that date all results are provisional, and while it will rarely if ever make a difference I want to match the 2018 rules which give 0:0 when both accounts are closed due to fair play violations, so that my script matches people's manual checks, and believe me, some people will check!

There's also the fact that 0:0 might not be exactly the same as 1/2-1/2 when tie-breaks come into the picture, but that's not my problem today.

stephen_33

Giles, problems with that endpoint apart, don't we have all the information we need in the team match endpoint? I can't immediately see what the match/board endpoint adds.

Although I'm starting to see problems now I'm getting closer to writing my own script. For example pairing up the two players on each board in order to adjust team scores & allot penalty points for closed accounts. That's not to say it's particularly difficult to solve, just that it's going to be a bit clumsy.

skelos

The per-board endpoint is a subset of the team match endpoint. TMCL wants the board information because TMCL's rules adjust scores post-match and chess.com's rules don't.

 

Although the script I'm writing is to score TMCL matches, the justification for changing the API output to match the documentation(*) is:

a) (The usual) Be able to see information the website reports, which without per-player team information for each match can't be done

b) Because I'd like it. happy.png

 

(*) Assuming I understand the documentation, and that someone doesn't come up with a better design than what is currently documented. I haven't thought about alternatives, but if there's an easier implementation that's as good or better for consumers of the API, I'd expect that to be fine.

skelos
stephen_33 wrote:
 
...
For example pairing up the two players on each board in order to adjust team scores & alot penalty points for closed accounts. That's not to say it's particularly difficult to solve, just that it's going to be a bit clumsy.

That's the bit that's actually impossible in some cases.

A trickier corner case would be a player A playing for team A' who played player B playing for team B'. During the match, B's account was closed for fair play violations. Sometime after the start of the match, player A joined team B' and now belongs to both. Without the missing team link you can't tell which side A or B were playing for in the match.

The case where both were closed is both simpler: you in fact don't need to know who played for which team; just score them as 0:0 and be done. (Which I hadn't thought about before; I did say I was confused.)

 

I think the problem remains that players can move teams so it is necessary to know which team a player played for in the match unless the chess.com adjustment is acceptable, which if provisional -> final results determination is not coincidental with the end of the match isn't enough.

 

I'll think about it some more tomorrow. Right now I think I've thought enough. Sorry if some of this is confusing, everyone.

stephen_33
skelos wrote:
stephen_33 wrote:... pairing up the two players on each board in order to adjust team scores & alot penalty points for closed accounts. That's not to say it's particularly difficult to solve, just that it's going to be a bit clumsy.

That's the bit that's actually impossible in some cases.

 

Why so? I'm still forming a solution to this in my mind but because I try to keep api requests to the absolute minimum, I plan to request only the team match data corresponding to each match_ID. Then I hope to be able to derive fully adjusted team scores from that match data alone.

Of course we know about the 'Closed: Abuse' problem & I'll have to flag up those uncommon cases for manual adjustment but beyond that, I don't see any snags at the moment. I don't fully grasp what the problem is with players joining opponent teams because that won't change the player details in the match endpoints, or will it?

What am I missing?

skelos

If one player on a board's status is closed:fair_play_violations you don't and can't tell which team to give the penalty point(s) to.

Since that's no different to the problem (at the moment) of 'closed' vs 'closed:abuse' I suppose we just flag such boards as needing manual examination and score them as 0:0 and adjust after looking at the website.

That does clarify things for TMCL's accounting. It isn't sufficient for some other things I want to do, so I'll continue to request that the (I think tentatively approved) 'closed:abuse' and 'closed: self_closed' statuses be added, and the documented 'team' url be implemented even for closed accounts.

If we're not going to get both of those by the end of August, there's no rush for either.

 

Thanks for your comments; they've clarified things a bit for me. Fingers crossed what's missing and why it's needed is clearer for other people too, but if not (Stephen or anyone) please keep the questions coming.

I do try to be clear but don't always succeed. Especially when I start out confused myself. grin.png

skelos

Ah, Stephen, you do need to look at the board scores to get the original game results. That's for the case when you don't want 4:0 against an account closed for fair play violations, but 3:0 or 2:0 due to timeouts on the honest player's side.

The "board_scores" (which are actually in the per-board data, but you could think of them as being a level up and it wouldn't make much difference) are the chess.com adjusted results which stop being adjusted when the match is complete.

skelos

Then there's that the board_scores result is 1/2-1/2 for each game and 1:1 for the board when both players are closed for fair play violations, and 2018 TMCL says 0:0. Refer mention of tiebreaks above. (Whether to change the TMCL rules sometime for easier accounting I don't know, don't mind, and this isn't the place to discuss.)

stephen_33

Giles, in TMCL our rules make no provision for whether or not the non-cheating player on a board has timed out or not. If an account is closed for abuse or fair play, the score is adjusted to 4:0 in favour of the (non-closed) opponent, no ifs, no buts.

If I examine the status of player_A in a pair & it shows "closed:fair_play_violations" then if player_B is not closed, they receive 4 points. Thats to say team_B has 4 points added to its accumulative score.

If player_B is also closed (FP) then neither team receives any points & I move on to the next board. If either player is closed for abuse then I flag that as an exception that needs manual intervention.

Only where neither player has status of closed do I examine the actual game results & add the appropriate points to that player's team total. I see no reason why that shouldn't be achievable at the moment, although I can see the coding being a little complicated & messy which is why I used the term clumsy above.

Examples from the match endpoint you linked to above:-

  • "played_as_black":"win","played_as_white":"win" ... 2 points added to accumulative score of that team
  • "played_as_black":"checkmated","played_as_white":"resigned" ... 0 points added to team score
  • "played_as_white":"agreed","played_as_black":"win" ... 1½ points added to team score

That way I can derive all the information I need from the match endpoint alone

skelos

TMCL side note: Stephen is (as is to be expected) right about TMCL scoring and I've no idea where I got my idea. It was quite firmly fixed in my mind ... and quite wrong?! They do say memory is the second thing to go, and I forget the first. Ouch.

 

skelos
stephen_33 wrote:

...

If I examine the status of player_A in a pair & it shows "closed:fair_play_violations" then if player_B is not closed, they receive 4 points. Thats to say team_B has 4 points added to its accumulative score.

...

And you tell who player_B played for from the team match endpoint which lists the teams, not the team match board endpoint.

Yes, I see.

This, you know, is not my finest moment. <sigh/>

Oh well, I said I was confused. Thank  you for explaining both my mis-recollection of the rules and how to work around the missing team information at the board level.

 

I think it makes sense to make the data match the documentation, but given my record so far in this thread I'll defer to whatever the developers think best!

 

Thanks,

Giles

stephen_33
skelos wrote:

TMCL side note: Stephen is (as is to be expected) right about TMCL scoring and I've no idea where I got my idea. It was quite firmly fixed in my mind ... and quite wrong?! They do say memory is the second thing to go, and I forget the first. Ouch. 

It was perfectly natural to assume that TMCL would operate as you thought because most of the leagues do things that way & avoid awarding forfeited points to players who have timed out. There seems to be a general objection among members to giving points to a player who couldn't be bothered to even play their game(s) & that's why we do things that way in Knockout.

But when it came to writing a new set of rules for the 2018 season of TMCL we decided to keep it simple. At least none of the TMCL admins seemed too concerned about it & it does make adjusting team scores that little easier!

skelos

Thanks Stephen. wink.png

stephen_33

Of course with the new atomatic awarding of forfeited points to the non-cheating opponent, I think the site software completely ignores whether or not the 'honest' player had timed out in either game.

At least I've searched through a lot of matches & I haven't yet found an instance in which the opponent of a closed-account-player is shown as having timed out. So I'm guessing that time-outs are not a consideration for the site?

Then of course it makes little sense for tournament organisers to worry about it  wink.png