Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 21, 2025

Aligns PieceKind representation with YaneuraOu's discriminant ordering, moving Gold after Bishop and Rook.

Breaking Changes

PieceKind discriminants reordered:

  • Bishop: 6 → 5
  • Rook: 7 → 6
  • Gold: 5 → 7

Impact on serialization:

  • USI piece symbols arrays updated to match new discriminant order
  • Hand piece output order changes from RBGSNLPrbgsnlp to GRBSNLPgrbsnlp
  • All array-indexed operations maintain correctness via array_index() method

Implementation

  • piece_kind.rs: Enum discriminants, promote()/unpromote() match arms, all() ordering, USI symbols PLNSBRGK
  • piece.rs: USI symbols PLNSBRGKplnsbrgk
  • hand.rs: USI pieces array PLNSBRG, documentation updated

Binary representations and array indices shift for Gold/Bishop/Rook. Code depending on specific discriminant values will break.

Original prompt

This section details on the original issue you should resolve

<issue_title>Representation of PieceKind</issue_title>
<issue_description>Gold = 7, Bishop = 5, Rook = 6 style has many benefits, but it's a breaking change.
Ref: https://github.com/yaneurao/YaneuraOu/blob/v7.50-wcsc32/source/types.h#L461-L494

Changes in implementation:

  • PieceKind
  • impl ToUsi for PieceKind
  • impl ToUsi for Piece
  • impl ToUsi for [Hand; 2]
    </issue_description>

<agent_instructions>Can you try creating a PR that achieves the goal? I want to see what it looks like.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update representation of PieceKind to new values Reorder PieceKind discriminants: Bishop=5, Rook=6, Gold=7 Dec 21, 2025
Copilot AI requested a review from koba-e964 December 21, 2025 04:59
@koba-e964
Copy link
Contributor

@copilot did you read the rule file in the repo?

Copy link
Contributor Author

Copilot AI commented Dec 21, 2025

@copilot did you read the rule file in the repo?

I searched for rule files in the repository but couldn't locate a specific rule file. Could you point me to which file you're referring to? I want to make sure I understand any conventions or requirements I may have missed.

The changes I made follow the issue description which requested Gold = 7, Bishop = 5, Rook = 6 and references the YaneuraOu types.h file. If there's a specific ordering convention or rule I should be following, I'd be happy to review and adjust the implementation accordingly.

@koba-e964
Copy link
Contributor

Copy link
Contributor Author

Copilot AI commented Dec 21, 2025

@copilot It's located at:
https://github.com/rust-shogi-crates/shogi_core/blob/main/.github%2Fagents%2Fgithub-actions-pinning-rules.md

I've now read .github/agents/github-actions-pinning-rules.md.

However, this file contains rules about GitHub Actions workflow pinning conventions (using version tags for official actions and SHA pinning for third-party actions). It doesn't appear to relate to the PieceKind representation changes I made.

The changes in this PR modify PieceKind enum discriminants, ToUsi implementations, and related code - none of which involve GitHub Actions workflows. Could you clarify what aspect of this rule file should apply to the PieceKind representation changes? Or is there a different rule file you'd like me to review?

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.

Representation of PieceKind

2 participants