GithubHelp home page GithubHelp logo

stared / quantum-game Goto Github PK

View Code? Open in Web Editor NEW
337.0 12.0 40.0 2.7 MB

Quantum Game (old version) - a puzzle game with real quantum mechanics in a browser

Home Page: http://v2016.quantumgame.io/

License: MIT License

JavaScript 69.76% CSS 5.74% HTML 23.78% Shell 0.44% Dockerfile 0.28%
quantum-mechanics quantum-game javascript game puzzle physics

quantum-game's Introduction

Quantum Game with Photons (2014-2016)

A note: this repository is an old Quanutm Game (2014-2016), no longer maintained. The new one (2019-) is at quantumgame.io.

Quantum Game - play with photons, superposition and entanglement. In your browser! With true quantum mechanics underneath!

Screenshot

Development version

It's JavaScript, ES6. To build it you need Node.JS and jspm.io package manager.

It's open for collaboration - from level creation, through interface (re)design and adding additional effects (two-photon interference, interactions with an electron). Interested? Mail [email protected].

Installing

After installing Node.js and jspm.io, and cloning this repository:

Then install local packages.

npm install
jspm install

Additionally, for development we use eslint with eslint-plugin-lodash.

A note: jspm is seriously outdated and the build may not work.

Running server

Start local HTTP server in the quantum game directory (e.g. by http-server). Does not need an install, as there are pre-built files.

Running tests

./node_modules/.bin/karma start

Production version

Bundle it (and minify, if you want):

jspm bundle-sfx --minify app

It creates a build.js file. To run it we need a modified index.html (it is a manually-modified file, stored in bundled/index.html).

On the server, the structure of files should look as follows:

css\
favicon.ico
build.js
index.html

Docker

Alternatively, you can install dependencies using Docker.

Building

Running

  • If your build completes sucessfully there will be a new image ID printed at the end of the build, which you can then use to to run it: docker run -d -p 80:8080 ${IMAGE_ID_FROM_BUILD}
  • or for a community built image try this: docker run -d -p 80:8080 spkane/quantum-game:latest

and then open up a web browser and point it to port 80 on your Docker host.

quantum-game's People

Contributors

julianvolodia avatar lurch avatar pathes avatar stared avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quantum-game's Issues

Leakage from interference of seemingly equal intensities

I attempted to design a 25/75 beam splitter and ran into a strange interference problem. I split the initial photon into 25%, 25%, and 50% beams without issue. I also managed to rearrange a 25% and 50% beam into two 37.5% beams (of equal phase). However, no matter how I try to merge those two beams through interference, I always end up with about 73% from one side of the half-silvered mirror and 2% from the other side.

At first I thought that one of the components was absorbing a fraction of the beam, causing the intensities to be slightly off. To that end, I've tried using a Mirror and a Coated 50/50 Beam Splitter; a Glass Slab, a Mirror and a 50/50 Beam Splitter (in case the Coated 50/50 Beam Splitter is to blame); and even some Quarter Wave Plates, Double Sugar Solution, Mirrors, and a 50/50 Beam Splitter (using circular polarization and sugar in case the Glass Slab is to blame). Each time, the result is the same: 73% leaves in the expected direction while 2% sneaks off at a right angle.

It seems like either there's something fundamental about interference that I'm missing, or there's a bug somewhere.

Analysis: The game reports the two 37.5% beams as (0.500 + 0.354i) and (-0.354 - 0.500i), giving them a intensity of 0.375316±0.0008545. It reports the 73% and 2% beams as (-0.604 - 0.604i) and (0.104 - 0.104i), giving them respective intensities of 0.729632±0.0012085 and 0.021632±0.0002085.

Below is a transcript of the quantum state as reported by the status message. Here is a copy of the level (pasted as .txt because Github doesn't like .json uploads). Any ideas?

(1.000)*|0,9,>|)
(0.707)*|1,9,>|) + (0.707i)*|1,9,^|)
(0.500)*|2,9,>|) + (0.500i)*|2,9,^|) + (0.500i)*|1,8,^|) + (-0.500)*|1,8,>|)
(0.354)*|3,9,>|) + (0.354i)*|3,9,^|) + (-0.707)*|2,8,>|) + (0.354i)*|1,7,^|) + (-0.354)*|1,7,>|)
(-0.354)*|4,9,^|) + (0.354i)*|3,8,^|) + (-0.707)*|3,8,>|) + (-0.354i)*|1,6,>|) + (-0.354)*|2,7,>|)
(-0.354)*|4,8,^|) + (-0.500)*|3,7,>|) + (-0.707)*|4,8,>|) + (-0.354i)*|2,6,>|)
(-0.354)*|4,7,^|) + (-0.500)*|4,7,>|) + (-0.707)*|5,8,>|) + (-0.354i)*|3,6,>|)
(-0.500i)*|4,6,>|) + (-0.500)*|5,7,>|) + (-0.500)*|6,8,>|) + (-0.500i)*|6,8,^|)
(0.500i)*|5,6,^|) + (-0.500)*|6,7,>|) + (-0.500)*|7,8,>|) + (-0.500i)*|6,7,^|)
(0.500i)*|5,5,^|) + (-0.354)*|7,7,>|) + (-0.354i)*|7,7,^|) + (-0.500)*|8,8,>|) + (-0.500i)*|6,6,^|)
(0.500i)*|5,4,^|) + (-0.354)*|8,7,>|) + (-0.354i)*|7,6,^|) + (0.500)*|9,8,^|) + (0.500i)*|6,5,>|)
(0.500i)*|5,3,^|) + (-0.250 + 0.354i)*|9,7,>|) + (0.354 - 0.250i)*|9,7,^|) + (-0.354 - 0.250i)*|7,5,^|) + (0.250 + 0.354i)*|7,5,>|)
(0.250 - 0.354i)*|10,7,^|) + (0.354 - 0.250i)*|9,6,^|) + (0.354 + 0.250i)*|7,4,>|) + (0.250 + 0.354i)*|8,5,>|)
(0.250 - 0.354i)*|10,6,^|) + (0.354 + 0.500i)*|9,5,>|) + (0.354 + 0.250i)*|8,4,>|)
(0.250 - 0.354i)*|10,5,^|) + (0.354 + 0.500i)*|10,5,>|) + (0.354 + 0.250i)*|9,4,>|)
(0.500 + 0.354i)*|10,4,>|) + (-0.354 - 0.500i)*|11,5,^|)
(0.104 - 0.104i)*|11,4,>|) + (-0.604 - 0.604i)*|11,4,^|)
(0.104 - 0.104i)*|12,4,>|) + (-0.604 - 0.604i)*|11,3,^|)
No goals, no judgement.

Switching between orthogonal and oscilloscope mode while photon is moving

Steps to reproduce:

  1. Start 1st level and build, say, a working solution (so that the photon is moving for a longer time)

  2. Click laser

  3. While photon is moving, click the button to switch from orthogonal to oscilloscope mode

Observed behavior: The graphics does not change. Only when I click on the laser again for the next time, the representation of the photon changes.

Expected behavior: The representation of the photon changes immediately.

Possible fixes: Either change the representation of the photon immediately (ideal solution) or deactivate the orthogonal/oscilloscope switch button while photon is moving.

Call for collaborators (interested? write a comment!)

Hi!

It is an open source project that would benefit from collaboration. So many ideas, but working alone is hard - so it stayed dormant for the last year. I am into games because I love instant feedback and interactions!

There are some bigger plans:

  • rewriting using some framework (still open for Angular, React or Vue)
    • right now approach of "just D3.js, not framework" is painful for managing states
    • open for suggestions from people with more frontend experience
  • potentially using TypeScript to make it better for tests
  • better graphics (of elements, animations)
  • more levels
  • level saving, loading and exchanging
  • displaying quantum states, a panel with quantum states step-by-step
  • making it modular, so boards with simulations can be used as parts of tutorials, not only in the game
  • better encyclopedia
  • 2-3 photons, 1-2 electrons (making it truly quantum!)
    • here I can do the maths; but to make it useful we need to have better modularization and quantum state display first

If you can help with one of those (or another ones), let me know!
Write a comment, saying which ones you would like (and what is your experience in these task).

Add a "label" block to freeplay

I was trying to use the freeplay mode to create an example setup. It would be useful if I could label different parts, similar to how the levels include labels.

There is nothing quantum in the gameplay

An essential component of quantum mechanics is particle-wave dualism, or collapse. However, there is nothing in the gameplay that exploits it. Sure, probabilities are displayed and taken into account at the end when displaying which detector has worked, which bomb has exploded, or what else has absorved the photon, but this information is irrelevant to the gameplay, because it does not affect the outcome, i.e. whether the level is solved. The game is thus about light intensity, polarization and phase, not individual photons.

Single Step sometimes restarts the evaluation

When I click on single step, it sometimes resends the laser pulse from the emitter instead of continuing the existing one.

You can see that here, as you can see the 'trail' of the old pulse 3 steps in, as well as the new laser pulse.

You can see
screenshot from 2018-01-10 14 30 52

Level 21 Issue with mirror

When the upper right mirror is in place as shown there is no interference at the beam splitter below it but interference does occur if the mirror is replaced with a beam splitter.

screenshot 2017-12-20 08 39 36

Add some introductory material

I puzzled my way through 34 levels without really understanding what I was doing. The grid layout, and the straight-forward physics of mirrors constrain your choices enough that you can kindof just brute force through various permutations of things. It would be nice to have a bit more background in what this game models. Also, while the game is fun, it's not clear exactly how this relates to building quantum computers.

Level 17 wrong polarizer images

There is a small problem with some polarizers in this level.
The polarizers on (i=5, j=7) and (i=8, j=5) have names that do not match their images. Especially for the 5,7 polarizer this can be confusing because it would suggest no polarization adaptation is needed.

(observed in Chrome, Version 64.0.3282.186 (Official Build) (64-bit))

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.