source: cpp/frams/_demos/genooper_test_fTest.cpp @ 569

Last change on this file since 569 was 319, checked in by Maciej Komosinski, 10 years ago

Fixed compilation warnings

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#include <frams/genetics/fT/oper_fTest.h>
6
7GenoOper_fTest gft;
8
9//A demonstration of genetic operations on the "T" (fTest) genetic format:
10int main()
11{
12        float chg;
13        char *g = strdup(gft.getSimplest());
14        for (int i = 0; i < 10; i++)
15        {
16                int _method; //unused
17                /*int result = */gft.mutate(g, chg, _method);
18                printf("%s   [mutated %.1f%%]\n", g, chg * 100);
19        }
20
21        char *g2 = strdup(gft.getSimplest());
22        float chg2;
23        printf("\nCrossing over the last mutant, \n\t%s\nand the simplest genotype\n\t%s\n:\n", g, g2);
24        gft.crossOver(g, g2, chg, chg2);
25        printf("Offspring 1:\n\t%s  (%.1f%% genes from parent1)\n", g, chg * 100);
26        printf("Offspring 2:\n\t%s  (%.1f%% genes from parent2)\n", g2, chg2 * 100);
27        free(g);
28        free(g2);
29
30        g = strdup("ATGsomethingCG");
31        printf("\nChecking genotype:\n\t%s... error at position %d.\n", g, gft.checkValidity(g));
32        gft.validate(g);
33        printf("After validation:\n\t%s\n", g);
34        free(g);
35        printf("...and how about YOUR genotype?\n\n");
36
37        return 0;
38}
Note: See TracBrowser for help on using the repository browser.