Skip to main content

TransformerCore

TransformerCore

abstract contract that contains all the utilities and types required for Transformer contract

GeneTransformType

enum GeneTransformType {
none,
add,
sub,
mult,
set
}

GeneMod

struct GeneMod {
enum TransformerCore.GeneTransformType geneTransformType;
uint256 value;
}

transform

function transform(uint256 currDna, uint8[] genes, struct TransformerCore.GeneMod[] modifications) internal pure returns (uint256 newDna)

Uses bitmask to transform inputted DNA according to modifications

NameTypeDescription
currDnauint256original DNA, represented in base 10
genesuint8[]array representing start indexes of genes within binary representation of currDna
modificationsstruct TransformerCore.GeneMod[]array describing modifications to each gene
NameTypeDescription
newDnauint256the transformed DNA

get256Bitmask

function get256Bitmask(uint16 startBit, uint16 endBit) internal pure returns (uint256 bitMask)

Generates a 256-bit bitmask from startBit:endBit

NameTypeDescription
startBituint16beginning of mask
endBituint16end of mask
NameTypeDescription
bitMaskuint256combined bitmask