Skip to content
Hex Gorillas WhiteCanvas 1.1
Share
Explore
Fundamentals

Breeding


The idea that you can generate an entirely new asset from two existing ones is not new, but the possibilities HG offers in the space are unparalleled. There are over 16 million possibilities, and although we will, once a can be created, limit the number of HG that can be created, it nonetheless offers endless possibilities for the community.
example:
var result = arr.map(person => ({ value: person.id, text: person.name }));
console.log(result)

(Solidity) v0.4.21+commit.dfe3193c
/// @dev An internal method that creates a new cutie and stores it. This
/// method does not check anything and should only be called when the
/// input data is valid for sure. Will generate both a Birth event
/// and a Transfer event.
/// @param _momId The cutie ID of the mom of this cutie (zero for gen0)
/// @param _dadId The cutie ID of the dad of this cutie (zero for gen0)
/// @param _generation The generation number of this cutie, must be computed by caller.
/// @param _genes The cutie's genetic code.
/// @param _owner The initial owner of this cutie, must be non-zero (except for the unCutie, ID 0)
function _createCutie(
uint40 _momId,
uint40 _dadId,
uint16 _generation,
uint16 _cooldownIndex,
uint256 _genes,
address _owner,
uint40 _birthTime
)
internal
returns (uint40)
{
Cutie memory _cutie = Cutie({
genes: _genes,
birthTime: _birthTime,
cooldownEndTime: 0,
momId: _momId,
dadId: _dadId,
cooldownIndex: _cooldownIndex,
generation: _generation,
optional: 0
});
uint256 newCutieId256 = cuties.push(_cutie) - 1;

// Check if id can fit into 40 bits
require(newCutieId256 <= 0xFFFFFFFFFF);

uint40 newCutieId = uint40(newCutieId256);

// emit the birth event
emit Birth(_owner, newCutieId, _cutie.momId, _cutie.dadId, _cutie.genes);

// This will assign ownership, as well as emit the Transfer event as
// per ERC721 draft
_transfer(0, _owner, newCutieId);

return newCutieId;
}
/// @notice Returns all the relevant information about a certain cutie.
/// @param _id The ID of the cutie of interest.
function getCutie(uint40 _id)
external
view
returns (
uint256 genes,
uint40 birthTime,
uint40 cooldownEndTime,
uint40 momId,
uint40 dadId,
uint16 cooldownIndex,
uint16 generation
) {
Cutie storage cutie = cuties[_id];

genes = cutie.genes;
birthTime = cutie.birthTime;
cooldownEndTime = cutie.cooldownEndTime;
momId = cutie.momId;
dadId = cutie.dadId;
cooldownIndex = cutie.cooldownIndex;
generation = cutie.generation;
}
/// @dev Assigns ownership of a particular Cutie to an address.
function _transfer(address _from, address _to, uint40 _cutieId) internal {
// since the number of cuties is capped to 2^40
// there is no way to overflow this
ownershipTokenCount[_to]++;
// transfer ownership
cutieIndexToOwner[_cutieId] = _to;
// When creating new cuties _from is 0x0, but we cannot account that address.
if (_from != address(0)) {
ownershipTokenCount[_from]--;
// once the cutie is transferred also clear breeding allowances
delete sireAllowedToAddress[_cutieId];
// clear any previously approved ownership exchange
delete cutieIndexToApproved[_cutieId];
}
// Emit the transfer event.
emit Transfer(_from, _to, _cutieId);
}

/// @dev For transferring a cutie owned by this contract to the specified address.
/// Used to rescue lost cuties. (There is no "proper" flow where this contract
/// should be the owner of any Cutie. This function exists for us to reassign
/// the ownership of Cuties that users may have accidentally sent to our address.)
/// @param _cutieId - ID of cutie
/// @param _recipient - Address to send the cutie to
function restoreCutieToAddress(uint40 _cutieId, address _recipient) public onlyOperator whenNotPaused {
require(_isOwner(this, _cutieId));
_transfer(this, _recipient, _cutieId);
}

address ownerAddress;
address operatorAddress;

bool public paused = false;

modifier onlyOwner()
{
require(msg.sender == ownerAddress);
_;
}



hex-breed.jpg
This is just a mockup of what is possible with our project. Using many methods and disciplines, we will obtain a working model by Phase Three. We welcome any and all feedback. In fact we need it!

const randomHex = () => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")}`;

// Result: #92b008

random_color
⚙️ 🎨 Rust crate for generating random attractive colors. Check it out on .
Inspired by .
1.2 kB
use random_color::{Color, Luminosity, RandomColor};

let color = RandomColor::new()
.hue(Color::Blue) // Optional
.luminosity(Luminosity::Light) // Optional
.seed(42) // Optional
.alpha(1.0) // Optional
.to_hsl_string(); //

// color => "hsl(179, 99%, 10%)"
Available outputs:
let color = RandomColor::new().to_hsv_array(); // color => [179, 20, 100]

// As RGB String
let color = RandomColor::new().to_rgb_string(); // color => "rgb(204, 255, 254)"

// As RGBA String
let color = RandomColor::new().to_rgba_string(); // color => "rgba(204, 255, 254, 1)"

// As RGB Array
let color = RandomColor::new().to_rgb_array(); // color => [204, 255, 254]

// As HSL String
let color = RandomColor::new().to_hsl_string(); // color => "hsl(179, 99%, 10%)"

// As HSLA String
let color = RandomColor::new().to_hsla_string(); // color => "hsl(179, 99%, 10%, 1)"

// As HSL Array
let color = RandomColor::new().to_hsl_array(); // color => [179, 99, 10]
// As Hex String
let color = RandomColor::new().to_hex(); // color => "#b31464"
Code Snips Courtesy by MIT License
exa.jpg
Although not nearly completely aligned to our vision and how, in particular, we want to focus on Hex color, you can see that there are possibilities before use, that we have already thought about. The main focus is that the initial NFT, will not remain the same. It will not sit dormant in your wallet or on an exchange. While you will be able to sell your asset, the benefits that your HG will receive will far outweigh any short-term financial gain. We will see how well this community comes together, and if it achieves half of what I think it is capable of, then we can change everything.
We would love to hear what you think about Hex Gorilla, and we really want to hear about your project!
Email us at or if you prefer, call or text us at |

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.