mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-02 17:31:08 +00:00
Merge pull request #293 from TheAlgorithms/changed_chaosmachine
added a option for termination the program
This commit is contained in:
commit
060988b896
|
@ -1,6 +1,12 @@
|
||||||
"""example of simple chaos machine"""
|
"""example of simple chaos machine"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
try:
|
||||||
|
raw_input
|
||||||
|
input = raw_input
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# Chaos Machine (K, t, m)
|
# Chaos Machine (K, t, m)
|
||||||
K = [0.33, 0.44, 0.55, 0.44, 0.33]; t = 3; m = 5
|
K = [0.33, 0.44, 0.55, 0.44, 0.33]; t = 3; m = 5
|
||||||
|
|
||||||
|
@ -32,8 +38,8 @@ def push(seed):
|
||||||
r # Saving to Parameters Space
|
r # Saving to Parameters Space
|
||||||
|
|
||||||
# Logistic Map
|
# Logistic Map
|
||||||
assert(max(buffer_space) < 1)
|
assert max(buffer_space) < 1
|
||||||
assert(max(params_space) < 4)
|
assert max(params_space) < 4
|
||||||
|
|
||||||
# Machine Time
|
# Machine Time
|
||||||
machine_time += 1
|
machine_time += 1
|
||||||
|
@ -91,7 +97,11 @@ message = random.sample(range(0xFFFFFFFF), 100)
|
||||||
for chunk in message:
|
for chunk in message:
|
||||||
push(chunk)
|
push(chunk)
|
||||||
|
|
||||||
|
# for controlling
|
||||||
|
inp = ""
|
||||||
|
|
||||||
# Pulling Data (Output)
|
# Pulling Data (Output)
|
||||||
while True:
|
while inp != "e" and inp != "E":
|
||||||
print("%s" % format(pull(), '#04x'))
|
print("%s" % format(pull(), '#04x'))
|
||||||
print(buffer_space); print(params_space)
|
print(buffer_space); print(params_space)
|
||||||
|
inp = input("(e)exit? ")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user