| Constant | Mask Value | Bits | Width |
|---|
// In your creature spawning contract: using genomix for uint256; mapping(uint256 => uint256) public creatureGenome; function spawnCreature(uint256 planetId, bytes32 vrfEntropy) external { // Fetch planet physics from your engine Planet memory p = planets[planetId]; // Derive genome deterministically from physics uint256 genome = genomix.deriveFromPlanet( p.carbon, p.silicon, p.oxygen, p.gravity, p.temperature, p.radiation, p.tidal, p.methane, vrfEntropy ); creatureGenome[nextId] = genome; emit CreatureSpawned(nextId++, genome); } function breed(uint256 parentId, bytes32 vrfSeed) external { // Deduct OBAMEOW tokens here obameow.burn(msg.sender, MUTATION_COST); uint256 child = genomix.mutate( creatureGenome[parentId], mutationIntensity, vrfSeed ); creatureGenome[nextId] = child; } function checkFitness(uint256 creatureId, uint256 planetId) external view returns (uint16 score) { Planet memory p = planets[planetId]; return genomix.fitnesScore( creatureGenome[creatureId], p.oxygen, p.gravity, p.temperature, p.radiation ); } function offChainDecode(uint256 creatureId) external view returns (genomix.DecodedGenome memory) { return genomix.decode(creatureGenome[creatureId]); }
XOR of two genomes — red bits = mutations between generations