GithubHelp home page GithubHelp logo

qchack-2022's Introduction

HQ-Hack 2022 - Quantum sudoku

Note: this is a draft.

Full repos of frontend and backend can be found here:

Team members

Lisa Bombieri
Tina Radkohl
Francesco Pinzauti
Kartik Sharma
Vishal Mandal

The game: quantum sudoku

In this game the player's goal is to solve a sudoku using quantum circuits.

Level 1 - warm up

In the first level, the player has to solve a 2x2 Sudoku using 0 and 1. A quantum circuit is given to the player with a given input state, fixed quantum gates and some additional single-qubit gates the user has to choose to solve the sudoku. These gates can be chosen between Hadamard, Z-gate, X-gate and Identity. The verification of the solution is done using a simulator which runs the circuits 1024 times, the sukodu is considered completed if the right outcome is obtained with probability 100%. The output will be True if the Sudoku is solved successfully. We implement the following quantum sudoku for this level:

The solution is given by the gates X, X, I and H (in order), which gives indeed the result 1001 with 100% probability.

Level 2

In the second level the players have to solve a 4x4 Sudoku, using numbers from 0 to 3. The quantum enconding works as following: 0 --> \ket{0}, 1 --> \ket{1}, 2 --> \ket{+} and 3 --> \ket{-}. In this case the players can choose both single-qubit gates (Hadamard, Z-gate, X-gate and Identity), two-qubit gates (Cnot, Cz) and also the measurement basis (z-basis and x-basis). The sudoku we invented is shown below:

The right solution is given by: single qubit gates = 'Z', 'H', 'H', 'H', 'H', 'H', 'X', 'I', 'H', 'H', 'Z', 'X' two qubit gates ='CZ', 'CX', 'CX', 'CZ', 'CZ', 'CZ' measurement basis = 'Mz', 'Mz', 'Mz', 'Mz', 'Mx', 'Mx', 'Mz', 'Mx', 'Mz', 'Mx' which gives the result 1100001100111100 (starting from q0 to the right) with 100% probability.

Instructions to run the game

  • form interface import play
  • play()
  • choose level 1 (level 2 in progress)
  • choose the gates following the insructions in the terminal
  • see if your result is correct

Level 2

To be properly implemented in the interface, if you wnat to try it follow the instructions:

  • use the notebook "sudoku_4x4_level1.ipynb" to visualize the empty sudoku and the associated circuit you have to edit
  • use the notebok "sudoku_4x4_level1_cod_measurement.ipynb" to insert your gates and measurements choices, run completed circuit and see if your solution is the right one.

Future developments

This game can be extended in many ways adding more difficult 4x4 sudoku or 6x6 sudoku using also the Y basis for the encoding.

qchack-2022's People

Contributors

brianingmanson avatar lisabombieri avatar pinzauti avatar

Watchers

 avatar

Forkers

vishal-mandal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.