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

Adding quantum checkers #189

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

LuukvandenNouweland
Copy link

Also added fix in the sparse vector simulator

Copy link

google-cla bot commented May 7, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

This game is created for the master thesis by Luuk van den Nouweland, university of Leiden.
Supervisor: Evert van Nieuwenburg

# Rules
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be a sub-heading "## Rules". Same for below. "# Rules" would be for the title.

# Rules
In this game, multiple rules are implemented.
1. Classical: Normal checkers
2. Superpositions: Checkers where pieces can exist in superposition
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be good to explain the rules a bit more. I don't understand what rules 3 and 4 mean in the context of checkers. Does rule 2 mean that you can move to two possible squares?

@@ -0,0 +1,311 @@
from enums import CheckersResult, CheckersRules, Colors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add copyright notice to the top of the file. See any other file in the repository for an example.

from copy import deepcopy

# GLOBAL GAME SETTINGS
forced_take = True
Copy link
Collaborator

Choose a reason for hiding this comment

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

Global constants should be all caps `FORCED_TAKE'. Also, I would explain what this option does.
Consider also putting this as part of the Checkers class.

BOTH_WIN = 4
"""
if (
len(self.board.calculate_all_possible_moves(Colors.WHITE)) == 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider setting these as variables so that you don't recalculate all the moves twice:
i.e.
num_white_moves = len(self.board.calculate_all_possible_moves(Colors.WHITE))

if len(possible_moves) - 1 == 0:
return possible_moves[0]
return possible_moves[randint(0, len(possible_moves) - 1)]
except Exception as error:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we swallowing all exceptions here?

print(possible_moves)


class exp_min_max(bot):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove until implemented.

with either X or O.

Args:
square: use TicTacQuare.X to do a sqrtSWAP(01) and
Copy link
Collaborator

Choose a reason for hiding this comment

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

This refers to TicTacToe.

import numpy as np


class QuditSplitGate(cirq.Gate):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a Split or a Swap?

return cirq.CircuitDiagramInfo(wire_symbols=(wire_code, wire_code))


class CheckersSplit(QuantumEffect):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why can't we use unitary.alpha.Split()?

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