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

Resolve #11: Fixing Fox's komi values #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

loarabia
Copy link

@loarabia loarabia commented Aug 8, 2023

Adds solution, test cases, and documentation.

First implementation followed KaTrain's model. Second implementation is based on my own logic after studying a number of files and debugging through parsing them.

Handling komi for Fox is trickier than it seems. I settled on detecting actual handicap stones to determine 0.5 scenarios and then used a combination of rulesets and handicap setting to determine between 6.5 and 7.5 handicap. There is likely more that I'm missing for other rulesets because I don't have good examples.

The logic is:

  1. To assume a common handicap, 6.5 because it is used on many game formats and servers.
  2. Then I check for fox specific scenarios around handicap and different rulesets.
  3. After that, I use the presence of handicap stones to figure out if the game should be 0.5 handicap and I assume the actual presence of handicap stones trumps everything else on Fox.

Note: The "Better" way for some of this would be to walk the nodes searching for the data we seek. E.g. instead of nesting into the data structure directly in search of Fox's AB nodes for adding black handicap stones, we should walk the tree searching for that node. However, since this solution is about fixing up a specific go client that likely writes it out consistently, I went with what was easier to write.

For the record, some servers like OGS and Pandanet (IGS) do put their handicap stone nodes with the rest of the game metadata in the root node and not in the first child.

This is just the functional part and two test files. Test cases coming
next as well as documentation.

Adjusting Komi on fox is added as an option you can pass to ParseToken.

This handles fox's komi in 3 cases by following kaTrain's fixup:
1. Handicap games it adjusts to 0.5 Komi
2. Even games using chinese rules it adjusts to 7.5 Komi (from 375)
3. From other rulesets it adjusts to (6.5 from 325)

Note: probably a bug here as some games have 0 as Komi and we shouldn't
add Komi in those cases.
After finding a number of test cases, I think this is more likely to get
the various scenarios across handicap stones, rulesets, and what not
correct.

Update test cases to cover.

Added documentation.

Handling komi for fox is trickier than it seems. I settled on detecting
actual handicap stones to determine 0.5 scenarios and then used a
combination of rulesets and handicap setting to determine between 6.5
and 7.5 handicap.

Note: The "Better" way for some of this would be to walk the nodes
searching for the data we see. IE instead of nesting into the data
structure directly in search of Fox's AB nodes for adding black stones,
we should walk the tree searching for that node. However, since this
solution is about fixing up a specific go client I went with what is
faster.

For the record some servers like Pandanet (IGS) do put their handicap
stones with the rest of the game metadata in the root node and not in
the first child.

The logic is to assume a common handicap, 6.5 which is used on many game
formats and servers.

Then I check for fox specific scenarios around handicap and different
rulesets. After that, I use the presence of handicap stones to figure
out if the game should be 0.5 handicap and I assume the actual presence
of handicap stones trumps everything else on Fox.
@loarabia loarabia changed the title Resolve #11: Fixing fox's Komi values Resolve #11: Fixing Fox's komi values Aug 8, 2023
@apetresc apetresc self-assigned this Aug 13, 2023
KM[11]
RU[Japanese]
;B[pq]
(;W[dc]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why is every single move a new branch?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure.

I think we'd have to ask @anoek over in OGS why the SGF is generated like that. IIRC, OGS only publicly publishes frontend code and not backend code so I don't think I can investigate why OGS SGF generation works that way.

I grabbed a game from my record on OGS and used it. I could pull something from KGS I suppose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apetresc, It turns out you aren’t the only person to ask this question. online-go/online-go.com#2005 I just piled on and asked there as well.

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

Successfully merging this pull request may close these issues.

2 participants