-
Notifications
You must be signed in to change notification settings - Fork 26
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] Update flying general check #168
Conversation
madcpf
commented
Oct 30, 2023
•
edited
Loading
edited
- Update flying general check to include the cases where there are quantum pieces between two kings(aka generals).
- Update Move to not depend on Board to break the cyclic dependency.
# Let the general/king fly, i.e. the opposite king will capture the current king. | ||
current_king = self.board[self.king_locations[self.current_player]] | ||
oppsite_king = self.board[self.king_locations[1 - self.current_player]] | ||
Jump(MoveVariant.CLASSICAL)(oppsite_king, current_king) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The game ends here, right? So, is it necessary to actually move the king? I guess there's no reason not to, but it seems unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Doug, yes the game ends here. I just chose to capture the other king so that later on we print the updated board as the last print of the game.
print("==== FLYING GENERAL ! ====") | ||
return True | ||
else: | ||
# TODO(): we are leaving the path pieces unchanged in entangled state. Maybe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine, right? since we measured the ancilla, it's guaranteed that all states remaining on the board have some piece in between.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Doug. Yes I've updated the comment here.
result = board.flying_general_check() | ||
# We check the ancilla to learn whether the general/king flies or not. | ||
captured = world.post_selection[world["ancilla_ancilla_flying_general_check_0_0"]] | ||
if captured: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to know that each branch of the if statement happens. (That some of the time it is captured and some of the time it is not).
One way to get one branch deterministically would be to test this:
board = set_board(["a3", "e0", "e9"])
board.king_locations = ["e0", "e9"]
board.current_player = 0 # i.e. RED
alpha.PhasedSplit()(world["a3"], world["e3"], world["e5"])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Doug. I just added this case as a separate test, where capture could not happen. But I cannot think of a way to deterministically make sure the capture happens.