Skip to content

Commit dc8c4b3

Browse files
author
Axel Dahlberg
authored
Merge pull request #13 from SoftwareQuTech/Develop
Develop
2 parents b234b44 + 25fc3bc commit dc8c4b3

File tree

6 files changed

+98
-6
lines changed

6 files changed

+98
-6
lines changed

.travis.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
language: python
2+
only:
3+
- master
4+
- Develop
5+
matrix:
6+
include:
7+
- name: Python 3.5 on Linux
8+
python: 3.5
9+
- name: Python 3.6 on Linux
10+
python: 3.6
11+
env:
12+
- BUILD=True
13+
- name: Python 3.7 on Xenial Linux
14+
python: 3.7
15+
dist: xenial
16+
- name: Python 3.7 on macOS
17+
os: osx
18+
osx_image: xcode10.2
19+
language: shell
20+
before_install:
21+
- make build
22+
install:
23+
- pip3 install dist/*.whl
24+
script:
25+
- make lint
26+
deploy:
27+
provider: pypi
28+
user: adahlberg
29+
password:
30+
secure: cQUlOGHX5ksULLBM2kOE9s2hdaJn4WK8rhD4LUuWndUG7rLeqtVfEMVrqWuMmzWcHXKOti143vgthSgp+akixfnQD7jWupVVSRiz5SFgq+1DRezGlkvYcZz2833on28lNFRiTjuPHkY3WoK0sS1iESxwTBvvi4y+q+AGtFzKE8hr+Pej+HnqFMMeXfqE7d/ZhoOrcBiRRcOrV/2JjpET5CMqimCYR4rz25yzpvVWlakC24vCqGs0Py+JL+VlZszjQz25NAQuuVwOAKnH/bapCV/JFmpvrFF5gKqAly9d1/+ZVgQVT9swMPjwmQs3zQ9E7IlL+4BPhdDly1H/GchyTRvf3uFt6Lok8ySvDyIkZUM2HlIoJIJCAESRCoEK7K7t1ySovBKjXI1Jc8O3QhAvdVMFWPpVxq5ZKwvUAEKtt7vRzN2KVmSi1nJxEzL89iuZkUtihws6DD8Y/6VgcemCFEZlP8ubxxRqR6gSaAhxSHppTdlNK2xUKq5AOwuS8A/3ur7SsMGasmMXTgQ/ElkrlHSZDvub4A89EMxfCMKrutIDPXSdpgYkmAvMFBsop+il/HJwWLc14xiNRsod4XVV5143M3pGg1wNKCifl2tTjbgoho9kFyso6RFkK28Qy3oSqZ+Sdw346M6jD6r2JVm7xsQZI7a5iR2Uq3PESkjkTP0=
31+
on:
32+
tags: true
33+
condition: $BUILD = True

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CHANGELOG
2+
=========
3+
4+
For more details refer to the [documentation](https://softwarequtech.github.io/SimulaQron/html/index.html).
5+
6+
Upcoming
7+
--------
8+
9+
2019-05-29 (v3.0.2)
10+
-------------------
11+
- Updated coinflip example and added CI.

cqc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.0.1'
1+
__version__ = '3.0.2'

cqc/pythonLib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
from simulaqron.settings import simulaqron_settings
9898
_simulaqron_version = simulaqron.__version__
9999
_simulaqron_major = int(_simulaqron_version.split('.')[0])
100-
except ModuleNotFoundError:
100+
except ImportError:
101101
_simulaqron_major = -1
102102

103103

examples/pythonLib/coinflipLeader/README.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@
22

33
## How to run
44

5+
First make sure that simulaqron is started with the nodes you'd want to include.
6+
This can be done with for example `simulaqron start` which by default starts a network
7+
with the nodes Alice, Bob, Charlie, David and Eve.
8+
Note that you need to be using either the qutip or projectq backend, since single-qubit
9+
rotations are used which are not supported in stabilizer formalism.
10+
To change the backend do `simulaqron set backend projectq`, which of course requires projectq
11+
to be installed (`pip install projectq`).
12+
13+
In this folder there is both an example with the four nodes Alice, Bob, Charlie and David
14+
and one where you can dynamically choose the nodes that the example uses.
15+
16+
To start either of the examples do
17+
```
18+
python3 fourPartyCoinFlip.py
19+
```
20+
or
521
```
6-
sh $NETSIM/run/startAll.sh
7-
./run.sh
22+
python3 nPartyCoinFlip.py
823
```
924

10-
Note that you need to give the nodes a few seconds to start up after running
11-
the first command.
25+
When running `nPartyCoinFlip.py` fill in the names you want to use (note that these needs to
26+
be in the current running network) and press enter when you're finished.
1227

1328
## Explanation
1429

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from cqc.pythonLib_protocols.coinflip_leader import CoinflipConsensus
2+
3+
4+
def main():
5+
6+
leaderChooser = CoinflipConsensus(arr) # Elects a leader from array that you declared
7+
return leaderChooser.leader()
8+
9+
# For 12-13-14-15 lines: After seeing "Add person" sentence, you can add person that how many person you want to add.
10+
# After adding one person you should press "enter" and then you can continue to add person with press enter
11+
# If you want to cancel from adding person you should press enter again
12+
# After enter the all name that you wanted to add you should press "enter"
13+
# Note that: you should use name from cqc's names space such as Alice, Bob, David, Eve Charlie.., you cant't use name randomly such as Gozde, Axel ...
14+
arr = [] # Here an empty array was defined
15+
veri = input("Add person")
16+
while veri:
17+
arr.append(veri)
18+
veri = input("Add person")
19+
20+
21+
# giving a value for each leader
22+
d = dict()
23+
for veri in arr:
24+
d[veri] = 0
25+
26+
# Runs 20 rounds of leader election and prints the results.
27+
for i in range(0, 20):
28+
if i % 10 == 0:
29+
print(i)
30+
d[main()] += 1
31+
32+
33+
print(d)

0 commit comments

Comments
 (0)