.get_memory() by quantumjim

[raw]
made by quantumjim for LD 44 (JAM)

.get_memory()

A game for Ludum Dare 44 made with Pygame and Qiskit.

How to run

You'll need Python3 to run this game.

First download the source and then cd into the folder using a terminal. To install the dependencies, use the command

python3 -m pip install -r requirements.txt

To play the game, use the command

python3 run_game.py

The game is played using two windows: the terminal window for text and the pygame window for visuals.

How to play

You move by pressing q, w, a and d. You can also teleport with the space bar. The rest is for you to figure out.

Why does this game exist?

There are three reasons that this game exists, and which led to it being what it is.

  1. It was built during the Ludum Dare 44 game jam, which had the theme "Your life is currency".

  2. It was made as an example of using terrain generated by a quantum programs, by the method described in this blog post.

  3. It was made to explore the kinds of labyrinths generated by the classic one-line Commodore 64 program

    10 PRINT CHR$(205.5+RND(1)); : GOTO 10

    This was ported into the following quantum program, which is the basis for the labyrinths in the game

    from qiskit import *; ''.join( [ '╱'*(b=='0') + '╲'*(b=='1') for b in execute(QuantumCircuit().from_qasm_str('include "qelib1.inc";qreg q[1];creg c[1];h q[0];measure q -> c;'),Aer.get_backend('qasm_simulator'),shots=1024,memory=True).result().get_memory()])

    The original program is referred to simply as 10 PRINT in this book about it, after the first part of the program. Inspired by this, I name my port of the program after a part near the end: .get_memory(). This is also used as the name of the game.

Things you might also like

  • Scientifically accurate animations of teleportation (for bitmaps), made using Qiskit (see here). These didn't quite make it into the game.
  • The history of games for quantum computers
  • A barely playable ASCII prototype for this game can be found here.

Ratings

Given 1🗳️ 0🗨️

Feedback

Tezza48
30. Apr 2019 · 18:57 UTC
Sorry but i was unable to launch the game.
I have `Python 3.6.5` installed and `pip 19.0.3`

This is the error that pip runs into when installing the requirements:
`Could not find a version that satisfies the requirement qiskit-aer==0.1.1 (from qiskit==0.8.0->-r requirements.txt (line 1)) (from versions: 0.1.0)
No matching distribution found for qiskit-aer==0.1.1 (from qiskit==0.8.0->-r requirements.txt (line 1))`

Note: the error when running was not having `pygame` but that's obvious as it's not getting the first one installed.
🎤 quantumjim
30. Apr 2019 · 21:03 UTC
Thanks for trying to run it @tezza48. Looks like this is an issue for some people with a 32 bit OS. Is that true for you?
Tezza48
30. Apr 2019 · 21:50 UTC
@quantumjim nope, I'm on 64 bit Win10.

I will try and have a go getting it running tomorrow after work and report back!

It could very well be an issue related to running multiple python version installs (though my environment is set to py3)
Adrien Dittrick
01. May 2019 · 09:45 UTC
Aaaaah I have python but this seems like a real pain to launch anyway X)
Tezza48
01. May 2019 · 20:19 UTC
OK, potentially sorted, i had python 3.6 installed but it was the 32 bit for some reason, i've installed 3.7 64 bit because why not; Seems to be installing requirements just fine!
Tezza48
01. May 2019 · 20:56 UTC
Hey dude. That was pretty cool and i had to work for it too! using the slash maze is a cool idea and the terrain is fancy. I Don't know much about quantum computing but i'm sure i'll get a good look at the page you provided.

(i tried to play again after my first game (pressed enter after the prompt) and got this error:
```
The island generation procedure is now beginning. The whole process should take around 30 seconds.

Traceback (most recent call last):
File ".\run_game.py", line 252, in <module>
make_world()
File "D:\tezza\Downloads\LD44_Games\get_memory\GetMemoryPygame.py", line 16, in make_world
Z, grid = quantum_tartan(Z,0.07)
File "D:\tezza\Downloads\LD44_Games\get_memory\WorldBuilder.py", line 241, in quantum_tartan
backend = Aer.get_backend('statevector_simulator')
NameError: name 'Aer' is not defined
```
Hope you can get it fixed up as it was cool.
🎤 quantumjim
01. May 2019 · 21:03 UTC
Thanks!

I'll see what I can do about the bug.