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

[Quantum Chinese Chess] Add SplitJump and MergeJump #166

Merged
merged 33 commits into from
Nov 29, 2023

Conversation

madcpf
Copy link
Collaborator

@madcpf madcpf commented Oct 23, 2023

Add SplitJump and MergeJump as new moves.

@madcpf madcpf marked this pull request as draft October 23, 2023 18:32
@madcpf madcpf marked this pull request as ready for review October 30, 2023 03:31
@madcpf madcpf requested a review from dstrain115 October 30, 2023 03:35
alpha.PhasedMove(-0.5)(source_0, target_0)
alpha.PhasedMove(-0.5)(source_1, target_0)
# Pass the classical properties of the source pieces to the target piece.
target_0.reset(source_0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This semantic is kind of confusing. I am not totally sure if this is correct. Remind me what reset is supposed to do again?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It copies the "type", "color" and "is_entangled" properties from source_0 to target_0.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see. And we are assuming that type, color are the same for source_0 and source_1.

Couldn't is_entangled be different for source_0 and source_1 though?
Also, do we ever fix the type/color for the source squares? Like, they may be empty now, right?

I don't think this logic is correct.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi Doug, yes, earlier in chess.py we've checked to make sure source_0 and source_1 have the same type, color, and is_entangled = true (maybe later we could support classical to merge with entangled piece).

The type/color/is_entangled for source squares are fixed through the method "update_board_by_sampling()" in chess.py, which will be called after each move. There are cases that they won't be reset to empty (see test cases for those scenarios).

The source piece for SplitJump will also be fixed through update_board_by_sampling().

Pengfei Chen and others added 2 commits November 9, 2023 15:34
@madcpf madcpf requested a review from dstrain115 November 10, 2023 00:00

def test_merge_jump_imperfect_merge_scenario_3():
# Imperfect merge scenario 3
# This is a simplied version of the scenario above, where we unhook a3 and b3.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider changing the line comments here and above to docstrings with triple quotes. I think they will show up in IDEs better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks Doug! It's updated.

@madcpf madcpf merged commit 6f1a18d into quantumlib:main Nov 29, 2023
6 checks passed
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.

2 participants