forked from martinventer/virtual_creatures
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
37 lines (32 loc) · 729 Bytes
/
test.py
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
36
37
from CreatureTools_n import Creature
import numpy as np
choices = [
'F',
'+',
'-',
]
proba1 = np.random.uniform(0, 1)
proba2 = 1 - proba1
rule1 = ''.join([np.random.choice(choices) for _ in range(5)]) + 'X'
rule2 = ''.join([np.random.choice(choices) for _ in range(5)]) + 'X'
params = {
'num_char': 100,
'variables': 'X',
'constants': 'F+-',
'axiom': 'X',
'rules': {
'X': {
'options': [
rule1,
rule2,
],
'probabilities': [proba1, proba2]
}
},
'point': np.array([0, 0]),
'vector': np.array([0, 1]),
'length': 1.0,
'angle': np.random.randint(0, 90) # random
}
c = Creature(params)
print()