-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateParameters.py
More file actions
35 lines (27 loc) · 935 Bytes
/
generateParameters.py
File metadata and controls
35 lines (27 loc) · 935 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
#!/bin/python
from evchess_evolve.current_parameters import STDPARAMETERS
from os import path, chdir
params = STDPARAMETERS()
chdir(path.dirname(path.realpath(__file__)))
Files = ['engine/include_setToZero',
'engine/include_initBrainStruct',
'engine/include_parameterReader']
SetToZero = []
InitBrainStruct = []
ParameterReader = []
for P in params:
shortName = P.name.split('_')[1]
Value = P.stdvalue if P.Enabled else 0
SetToZero.append("Brain.%s = %.2f;" % (shortName, Value))
InitBrainStruct.append("float %s;" %(shortName))
if P.Enabled:
ParameterReader.append('readparam(line, V, "%s", &Brain.%s);' %\
(P.name, shortName))
for F in Files:
z=open(F, 'a').close()
W = open(Files[0], 'w')
W.write('\n'.join(SetToZero))
W = open(Files[1], 'w')
W.write('\n'.join(InitBrainStruct))
W = open(Files[2], 'w')
W.write('\n'.join(ParameterReader))