Skip to content

Update engine.py#11

Merged
windshadow233 merged 1 commit intowindshadow233:mainfrom
gameisfunny2025:patch-1
Aug 18, 2025
Merged

Update engine.py#11
windshadow233 merged 1 commit intowindshadow233:mainfrom
gameisfunny2025:patch-1

Conversation

@gameisfunny2025
Copy link
Copy Markdown
Contributor

the old one is for chess, not for xiangqi

the old one is for chess, not for xiangqi
@windshadow233 windshadow233 requested a review from Copilot August 18, 2025 12:04

This comment was marked as outdated.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the UCI (Universal Chess Interface) regex pattern to support Xiangqi (Chinese chess) instead of standard chess. The change modifies the coordinate system and piece notation to match Xiangqi's 9x10 board layout and piece set.

  • Updates regex pattern from chess coordinates (a-h, 1-8) to Xiangqi coordinates (a-i, 0-9)
  • Changes piece notation from chess pieces (pnbrqk/PNBRQK) to Xiangqi pieces (pnbrack/PNBRACK)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread cchess/engine.py


UCI_REGEX = re.compile(r"^[a-h][1-8][a-h][1-8][pnbrqk]?|[PNBRQK]@[a-h][1-8]|0000\Z")
UCI_REGEX = re.compile(r"^[a-i][0-9][a-i][0-9][pnbrack]?|[PNBRACK]@[a-i][0-9]|0000\Z")
Copy link

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The regex pattern [0-9] matches any single digit (0-9), but Xiangqi uses a 10x9 board with ranks 0-9. This means rank 10 would require two digits and won't be matched by this single digit pattern. Consider using a more specific pattern like [0-9]|10 or (?:[0-9]|10) to properly handle rank 10.

Suggested change
UCI_REGEX = re.compile(r"^[a-i][0-9][a-i][0-9][pnbrack]?|[PNBRACK]@[a-i][0-9]|0000\Z")
UCI_REGEX = re.compile(r"^[a-i](?:[0-9]|10)[a-i](?:[0-9]|10)[pnbrack]?|[PNBRACK]@[a-i](?:[0-9]|10)|0000\Z")

Copilot uses AI. Check for mistakes.
@windshadow233 windshadow233 merged commit 35fe739 into windshadow233:main Aug 18, 2025
@windshadow233 windshadow233 removed their request for review August 18, 2025 12:07
@windshadow233
Copy link
Copy Markdown
Owner

Thanks for your contribution!😊

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants