Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rescoring and walkovers #6

Closed
a5sk4s opened this issue Jan 2, 2015 · 5 comments
Closed

rescoring and walkovers #6

a5sk4s opened this issue Jan 2, 2015 · 5 comments
Labels

Comments

@a5sk4s
Copy link

a5sk4s commented Jan 2, 2015

the recent enhancement to allow rescoring under certain conditions (see: tournament-js/tournament#20) fails if either left or down is a walkover game - the down case can occur in the first round of double elimination tournaments

is it sufficient fix the criteria in the _safe routine for the walkover games, by looking one level deeper?

@clux
Copy link
Collaborator

clux commented Jan 2, 2015

That's interesting, if so then a _safe fix is in order.

Could you be a little more specific about the case you are looking at?

For a 5 player double elimination I can rescore the match that send a player down to a WO match in LB fine. Otherwise, if right is a WO match, then so is the current one so you cannot rescore it anyway. Unless I am missing something.

@a5sk4s
Copy link
Author

a5sk4s commented Jan 3, 2015

This was my manual test with a 5 player tournament:

d = new Duel(5, { last: Duel.LB });
d.score({ s: 1, r: 1, m: 2 }, [0,1]);
d.unscorable({ s: 1, r: 1, m: 2 }, [1,0]);
'S1 R1 M2 cannot be re-scored'

m = d.findMatch({ s: 1, r: 1, m: 2 });
d._safe(m)
false

This is the relevant part of the loser bracket before

  { id: { s: 2, r: 1, m: 1 },
    p: [ -1, 0 ],
    m: [ 0, 1 ] },
  { id: { s: 2, r: 1, m: 2 },
    p: [ -1, -1 ],
    m: [ 0, 1 ] },
  { id: { s: 2, r: 2, m: 1 },
    p: [ 0, 0 ] },
  { id: { s: 2, r: 2, m: 2 },
    p: [ -1, 0 ] },

and after the d.score({ s: 1, r: 1, m: 2 }, [0,1]); call

  { id: { s: 2, r: 1, m: 1 },
    p: [ -1, 5 ],
    m: [ 0, 1 ] },
  { id: { s: 2, r: 1, m: 2 },
    p: [ -1, -1 ],
    m: [ 0, 1 ] },
  { id: { s: 2, r: 2, m: 1 },
    p: [ 0, 5 ] },
  { id: { s: 2, r: 2, m: 2 },
    p: [ -1, 0 ] },

I think the fact that match { s: 2, r: 1, m: 1 } is a walkover match interferes with the re-scoring.

Please let me know if I can help in any other way.

@clux
Copy link
Collaborator

clux commented Jan 3, 2015

Oh yeah, I see now. This is a nice find.

Since .score will change both LBR1M1 and LBR2M1 correctly so it's only an unscorable problem with the new fine grained access control in the _safe virtual. We want to ensure that the LBR2M1 match is not already scored before we blindly allow re-scoring WBR1M2.

Technically it is impossible for the relevant LBR2 match to be scored without also the WBR2 match right of the one we are re-scoring in WBR1 to also be scored. Unfortunately, a similar argument does not hold if you drop on top of a WO marker in LBR2 from WBR2 (then you can have played LBR3 match without WBR3 being touched). Thus, no short-cuts can be really be made; _safe must always check [right, down, down ∘ right] are all unplayed when exists (similar to how _progress does it).

I'll make a fix for this soon. Have written up a test for the cases discussed. Thanks for reporting this 👍

@clux clux added the bug label Jan 3, 2015
@clux clux closed this as completed in a59f97d Jan 3, 2015
@clux
Copy link
Collaborator

clux commented Jan 3, 2015

Fixed in duel@3.0.1

Thanks again :]

@a5sk4s
Copy link
Author

a5sk4s commented Jan 3, 2015

Your welcome. It's been my pleasure. Thanks for the quick turnaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants