Last change
on this file since 1083 was
1083,
checked in by Maciej Komosinski, 4 years ago
|
Allowed to override the default name of frams-objects.dll/so
|
File size:
1.0 KB
|
Line | |
---|
1 | import sys
|
---|
2 | import frams
|
---|
3 |
|
---|
4 | frams_path = sys.argv[1] # set to the directory where Framsticks binaries and libraries exist
|
---|
5 | frams.init(frams_path, sys.argv[2] if len(sys.argv) > 2 else None, "-Ddata") # "-D"+os.path.join(framspath,"data")) # not possible (maybe python windows issue) because of the need for os.chdir(). So we assume "data" is where the dll/so is
|
---|
6 |
|
---|
7 | print('Available objects:', dir(frams))
|
---|
8 | print()
|
---|
9 |
|
---|
10 |
|
---|
11 | def extValueDetails(v):
|
---|
12 | return '"' + str(v) + '" frams type=' + str(v._type()) + ' frams class=' + str(v._class()) + ' python type=' + str(type(v._value()))
|
---|
13 |
|
---|
14 |
|
---|
15 | v = frams.String.deserialize('[100,2.2,"abc",[null,[]],XYZ[9,8,7]]')
|
---|
16 | print(extValueDetails(v))
|
---|
17 | for e in v:
|
---|
18 | print(extValueDetails(e))
|
---|
19 |
|
---|
20 | g = frams.GenePools[0].add('X')
|
---|
21 | g.name = "py!"
|
---|
22 | g.data['custom'] = 123.456
|
---|
23 | g.data['a'] = 'b'
|
---|
24 |
|
---|
25 | for more in range(5):
|
---|
26 | frams.GenePools[0].add(frams.GenMan.mutate(g.geno))
|
---|
27 |
|
---|
28 | for g in frams.GenePools[0]:
|
---|
29 | print(str(g.index) + '. "' + str(g.name) + '" ' + str(g.genotype) + ' data=' + str(g.data))
|
---|
Note: See
TracBrowser
for help on using the repository browser.