codenameyau / hello-evolution

String matching genetic algorithm with fitness+diversity
MIT License
0 stars 0 forks source link

Tabular Data utils #2

Closed codenameyau closed 8 years ago

codenameyau commented 8 years ago

Create a utils method called, logTable, which should automatically justify the number of spaces for each column.

Generation | Survived | Max Fitness | Phenotype
-----------|----------|-------------|-----------
0          | 20       | 1           | "3z"Lo"
1          | 79       | 2           | "ke#l_"
2          | 52       | 2           | "3B%lo"
3          | 56       | 2           | "cRll&"
4          | 47       | 2           | "SejlB"
5          | 92       | 3           | "cellU"
6          | 61       | 3           | "cellX"
7          | 43       | 3           | ")eNlo"
8          | 48       | 4           | "Bello"
9          | 21       | 4           | ")ello"
10         | 95       | 4           | "!ello"
11         | 64       | 5           | "Hello"
codenameyau commented 8 years ago

Close enough. Tabs

---------------------------------------------------------
Generation  Survived    Max Fitness Phenotype
---------------------------------------------------------
0       31      1       J|l}W       
1       37      1       @"l.?       
2       40      2       H?1Lo       
3       47      2       6IlLo       
4       53      3       HdlZo       
5       31      3       H|lqo       
6       45      3       HdlZo       
7       56      3       H/lZo       
8       42      3       H@lPo       
9       50      4       H/llo       
10      31      4       Helqo       
11      41      5       Hello