Skip to content

Fix URL encoding of the last dot in kurarin (#665)#699

Merged
x-sheep merged 1 commit intorobx:mainfrom
mashinosatoshi:fix/issue-665_kurarin-url-encoding
Mar 25, 2026
Merged

Fix URL encoding of the last dot in kurarin (#665)#699
x-sheep merged 1 commit intorobx:mainfrom
mashinosatoshi:fix/issue-665_kurarin-url-encoding

Conversation

@mashinosatoshi
Copy link
Copy Markdown
Contributor

Description

Fixes #665

URL encoding and decoding for kurarin currently ignores the state of the bottom-right dot. This happens because kurarin boards always have an odd number of dots, and the bitwise calculation (bd.dots.length >> 1) | 1 evaluates to 1 less than the required encoded length.

This PR updates the calculation to (bd.dots.length + 1) >> 1 (equivalent to Math.ceil(bd.dots.length / 2)) in both encodeKurarin and decodeKurarin to ensure all dots are properly processed.

Changes

  • Fix encodeKurarin and decodeKurarin length calculations in src/variety/kurarin.js
  • Add a round-trip test test/variety/kurarin_test.js to verify URL encoding for the last two dots

Testing

  • Modified test passes locally.
  • Run npm run format and npm test without any issues.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 24, 2026

@mashinosatoshi is attempting to deploy a commit to the robx's projects Team on Vercel.

A member of the Team first needs to authorize it.

@x-sheep x-sheep self-requested a review March 24, 2026 17:32
@x-sheep x-sheep added the bug Something isn't working label Mar 24, 2026
@x-sheep x-sheep merged commit efd1b2b into robx:main Mar 25, 2026
1 of 2 checks passed
@x-sheep
Copy link
Copy Markdown
Collaborator

x-sheep commented Mar 25, 2026

Thanks, this looks good to me!

@mashinosatoshi mashinosatoshi deleted the fix/issue-665_kurarin-url-encoding branch March 25, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kurarin: url encoding may ignore the last cell

2 participants