.get_memory() by quantumjim
.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.
It was built during the Ludum Dare 44 game jam, which had the theme "Your life is currency".
It was made as an example of using terrain generated by a quantum programs, by the method described in this blog post.
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 10This 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 PRINTin 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.
| Source Code | https://github.com/quantumjim/get_memory/blob/master/README.md |
| Original URL | https://ldjam.com/events/ludum-dare/44/get-memory |
Ratings
| Given | 1🗳️ | 0🗨️ |
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.
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)
(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.
I'll see what I can do about the bug.