thecommons-urbit / chess

Distribution repo for Urbit Chess app
Other
26 stars 8 forks source link

Show win/loss record #148

Closed bonbud-macryg closed 1 year ago

bonbud-macryg commented 1 year ago

Resolves #17.

bonbud-macryg commented 1 year ago

Bug: draws aren't shown in the UI tally.

bonbud-macryg commented 1 year ago

I think I've found the culprit, receiveArchivedGame is storing two versions of our (~dev) results in tallies. It's also not storing draws in opponents' results. Will address later.

ashelkovnykov commented 1 year ago

@bonbud-macryg The code itself looks good. Are the ~dev games from playing against yourself? I think that might confuse the algorithm in chessStore. We should probably have code to ignore computing tallies when our ship is both sides.

bonbud-macryg commented 1 year ago

@ashelkovnykov Having a safeguard against playing yourself is a good idea, I should add that in. But all these games are between ~dev and ~ser. As of c6ac28c ~dev is seeing the right output but ~ser isn't seeing draws in the tallies results from receiveArchivedGames.

bonbud-macryg commented 1 year ago

Found the source of the bug: When a game ends in a draw, the player who made the final move correctly logs this but the other player never receives the move.

This is reflected both in each player's Results tuple (logged in both receiveArchivedGame and getTally) and in the backend, checked via +dbug. The player who should have received the concluding move still has the game stored in their active games.

Fastest way to draw a game here.

bonbud-macryg commented 1 year ago

Looks like this bug is present in develop as well. I remember testing this PR with no issue before your review, back when it was based on PR #109 rather than develop.

bonbud-macryg commented 1 year ago

Some outstanding linter issues still to be taken care of.