Monochrome biomorph genome
The monochrome biomorph genome has 16 genes. The colour biomorph genome extends the monochrome genome by adding genes for color and limb geometry.
In 'Monochrome WatchMaker/Globals', the monochrome biomorph genome is defined as a Pascal RECORD type called 'person'. Among 'person's field declarations are four fields of the custom data types chromosome, SwellType, CompletenessType, and SpokesType. The custom type definitions, and the definition of the 'person' genome record type, are as below:
TYPE
chromosome = ARRAY[1..9] OF Integer;
SwellType = (Swell, Same, Shrink);
CompletenessType = (Single, Double);
SpokesType = (NorthOnly, NSouth, Radial);
person = RECORD
gene: chromosome;
dgene: ARRAY[1..10] OF SwellType;
SegNoGene: Integer;
SegDistGene: Integer;
CompletenessGene: CompletenessType;
SpokesGene: SpokesType;
tricklegene, mutsizegene, mutprobgene: Integer;
END;
The original version of Blind Watchmaker ran on the Classic Mac platform, where enumerated type values were serialized as a single byte (0-based), INTEGER types were serialized as two bytes in little-endian order. The following code is taken from the XCode Pascal part of Monochrome Watchmaker, as part of its serialization routine, which must bridge the change between the little-endianness of the Classic Mac architecture and that of OS X, which began little-ended (with the PowerPC) and became big-ended (with the Intel processor changeover.)
const
kSwellTypeSwell = 0;
kSwellTypeSame = 1;
kSwellTypeShrink = 2;
kCompletenessTypeSingle = 0;
kCompletenessTypeDouble = 1;
kSpokesTypeNorthOnly = 0;
kSpokesTypeNSouth = 1;
kSpokesTypeRadial = 2;
type
chromosomeArrayDuo = ARRAY[1..9] OF arrayDuo;
PersonSerializer = record
gene: chromosomeArrayDuo;
dgene: ARRAY[1..10] of byte;
SegNoGene: arrayDuo;
SegDistGene: arrayDuo;
CompletenessGene: byte;
SpokesGene: byte;
tricklegene: arrayDuo;
mutsizegene: arrayDuo;
mutprobgene: arrayDuo;
end;
person = RECORD
gene: chromosome;
dgene: ARRAY[1..10] OF SwellType;
SegNoGene: Integer;
SegDistGene: Integer;
CompletenessGene: CompletenessType;
SpokesGene: SpokesType;
tricklegene, mutsizegene, mutprobgene: Integer;
END;
Four application-defined types are referenced in the genome. 'chromosome' is an array of nine integers. The field 'dgene' is an array of 10 SwellType values: the allowed values for each SwellType are Shrink, Same, and Swell.
Each SwellType value applies to one integer gene: from Gene 1 through 9, with the 10th SwellType value applying to SegDistGene.
In Monochrome/unit_globals.pas, the definition is unchanged from the original Pascal source above.
In the Java reference implementation of Blind Watchmaker, the class MonochromeGenome defines the monochrome biomorph genome. Its toGeneArray() method returns the genes in order:
Gene[] theGenes = new Gene[16];
theGenes[0] = gene1;
theGenes[1] = gene2;
theGenes[2] = gene3;
theGenes[3] = gene4;
theGenes[4] = gene5;
theGenes[5] = gene6;
theGenes[6] = gene7;
theGenes[7] = gene8;
theGenes[8] = gene9;
theGenes[9] = segNoGene;
theGenes[10] = segDistGene;
theGenes[11] = completenessGene;
theGenes[12] = spokesGene;
theGenes[13] = trickleGene;
theGenes[14] = mutSizeGene;
theGenes[15] = mutProbGene;