forked from martinventer/virtual_creatures
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmontepython_1.0.py
More file actions
35 lines (28 loc) · 758 Bytes
/
montepython_1.0.py
File metadata and controls
35 lines (28 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from CreatureTools import Creature
import numpy as np
from tqdm import tqdm
from multiprocessing import Pool
def genGen():
params = {
'num_char': 100,
'variables': 'X',
'constants': 'F+-',
'axiom': 'FX',
'rules': {
'X': {
'options': ['+FX', '-FX'],
'probabilities': [0.5, 0.5]
}
},
'point': np.array([0, 0]),
'vector': np.array([0, 1]),
'length': 1.0,
'angle': 25 # random
}
return Creature(params).coords
if __name__ == "__main__":
iter = 1000
with Pool(4) as p:
results = list(tqdm([p.apply_async(genGen)], total=iter))
# population.append([f.get() for f in results])
print()