Ignore:
Timestamp:
06/22/16 16:41:58 (8 years ago)
Author:
Maciej Komosinski
Message:

Code formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/saver_test_geno.cpp

    r517 r520  
    1111
    1212 \include saver_test_geno.cpp
    13 */
     13 */
    1414
    15 int main(int argc,char*argv[])
     15int main(int argc, char*argv[])
    1616{
    17 if (argc<3)
     17        if (argc < 3)
    1818        {
    19         fprintf(stderr,"Arguments: filename number_of_genotypes\n"
    20              "Example: saver_test_geno file.gen 3\n"
    21                 );
    22         return 1;
     19                fprintf(stderr, "Arguments: filename number_of_genotypes\n"
     20                        "Example: saver_test_geno file.gen 3\n"
     21                        );
     22                return 1;
    2323        }
    2424
    25 StdioFileSystem_autoselect stdiofilesys;
    26 VirtFILE *f=Vfopen(argv[1],"w");
    27 if (f)
     25        StdioFileSystem_autoselect stdiofilesys;
     26        VirtFILE *f = Vfopen(argv[1], "w");
     27        if (f)
    2828        {
    29         int N=atoi(argv[2]);
    30         MiniGenotype g;
    31         Param p(minigenotype_paramtab,&g);
    32         g.clear();
    33         printf("Saving %d genotypes to %s\n",N,argv[1]);
    34         for(int i=1;i<=N;i++)
     29                int N = atoi(argv[2]);
     30                MiniGenotype g;
     31                Param p(minigenotype_paramtab, &g);
     32                g.clear();
     33                printf("Saving %d genotypes to %s\n", N, argv[1]);
     34                for (int i = 1; i <= N; i++)
    3535                {
    36                 g.name=SString::sprintf("Genotype#%d",i);
    37                 g.genotype=""; for(int x=0;x<i;x++) g.genotype+="X";
    38                 g.velocity=0.1*i;
    39                 g.energy0=1;
    40                 g.info="Saved by saver_test_geno.cpp";
    41                 g.is_valid=1;
    42                 p.save(f,"org");
     36                        g.name = SString::sprintf("Genotype#%d", i);
     37                        g.genotype = ""; for (int x = 0; x < i; x++) g.genotype += "X";
     38                        g.velocity = 0.1*i;
     39                        g.energy0 = 1;
     40                        g.info = "Saved by saver_test_geno.cpp";
     41                        g.is_valid = 1;
     42                        p.save(f, "org");
    4343                }
    44         delete f;
    45         return 0;
     44                delete f;
     45                return 0;
    4646        }
    47 else
     47        else
    4848        {
    49         printf("Could not write to %s\n",argv[1]);
    50         return 1;
     49                printf("Could not write to %s\n", argv[1]);
     50                return 1;
    5151        }
    5252}
Note: See TracChangeset for help on using the changeset viewer.