Search…
Ok. Math. Gorillas?
Breeding
With over 16 million hex code (color) options available, we need a way to determine a "less than random" output from the breeding mechanics. Consider this: if you knew that just roughly 1600 truly rare hues existed among those 16 million, wouldn't you want to make sure you had the chance? What's amazing about our breeding technique is that I basically just handed you the cheat code. Of course, color, like any other design element, is subjective to the spectator. However, we did not go into this undertaking unprepared. And the case for color has already been proven in one Tezo project. TZcolor.io has some of those rare colors right now, being sold for 300 Tez. "Absolute Zero," (#0048BA) is a color that was formulated by scientists to represent the actual Absolute Zero. It is extremely rare to see in any webpage, and in fact I would argue the only time the color shows up, is to cite how often it does not appear.

The Common Crawl

​The Common Crawl is a repository. That's a bit of an exaggeration. Did you know they have a backup of the entire internet dating back to 2008? When I first learned about this database, I was in my senior year at Cal Poly, and my thesis topic was the rise and fall of technology. My professor directed me to the Common Crawl. I had everything I could ever want after figuring out how to gain its knowledge.
We had a big question to answer with Hex Gorilla. What are some colors that are almost never used in HTML or stylesheets? Some, believe it or not, have almost never appeared on a website. I won't give too much away, but there are 12 of those rare colors in the first 100 mints.
​
The idea that you may not only develop a whole new asset out of two existing ones, but also know how to increase your chances of acquiring a really rare one is astounding, and the possibilities presented by HG in this field are unequaled. There are countless choices, and while we will limit the quantity of HG that can be generated after establishing a decentralized autonomous organization (DAO), the community will still have endless opportunities.
1
/// @dev An internal method that creates a new cutie and stores it. This
2
/// method does not check anything and should only be called when the
3
/// input data is valid for sure. Will generate both a Birth event
4
/// and a Transfer event.
5
/// @param _momId The hex ID of the mom of this cutie (zero for gen0)
6
/// @param _dadId The hex ID of the dad of this cutie (zero for gen0)
7
/// @param _generation The generation number of this hex, must be computed by caller.
8
/// @param _genes The hex's genetic code.
9
/// @param _owner The initial owner of this hex, must be non-zero (except for the unHex, ID 0)
10
function _createCutie(
11
uint40 _momId,
12
uint40 _dadId,
13
uint16 _generation,
14
uint16 _cooldownIndex,
15
uint256 _genes,
16
address _owner,
17
uint40 _birthTime
18
)
19
internal
20
returns (uint40)
21
{
22
Cutie memory _cutie = Cutie({
23
genes: _genes,
24
birthTime: _birthTime,
25
cooldownEndTime: 0,
26
momId: _momId,
27
dadId: _dadId,
28
cooldownIndex: _cooldownIndex,
29
generation: _generation,
30
optional: 0
31
});
32
uint256 newHexId256 = cuties.push(_cutie) - 1;
33
​
34
// Check if id can fit into 40 bits
35
require(newCutieId256 <= 0xFFFFFFFFFF);
36
​
37
uint40 newhexId = uint40(newCutieId256);
38
​
39
// emit the birth event
40
emit Birth(_owner, newCutieId, _cutie.momId, _hex.dadId, _hex.genes);
41
​
42
// This will assign ownership, as well as emit the Transfer event as
43
// per ERC721 draft
44
_transfer(0, _owner, newHexId);
45
​
46
return newCutieId;
47
}
48
49
/// @notice Returns all the relevant information about a certain cutie.
50
/// @param _id The ID of the cutie of interest.
51
function getHex(uint40 _id)
52
external
53
view
54
returns (
55
uint256 genes,
56
uint40 birthTime,
57
uint40 cooldownEndTime,
58
uint40 momId,
59
uint40 dadId,
60
uint16 cooldownIndex,
61
uint16 generation
62
) {
63
Cutie storage hex = hexs[_id];
64
​
65
genes = hex.genes;
66
birthTime = hex.birthTime;
67
cooldownEndTime = hex.cooldownEndTime;
68
momId = hex.momId;
69
dadId = hex.dadId;
70
cooldownIndex = hex.cooldownIndex;
71
generation = hex.generation;
72
}
73
74
/// @dev Assigns ownership of a particular Hex to an address.
75
function _transfer(address _from, address _to, uint40 _cutieId) internal {
76
// since the number of hexs is capped to 2^40
77
// there is no way to overflow this
78
ownershipTokenCount[_to]++;
79
// transfer ownership
80
cutieIndexToOwner[_hexId] = _to;
81
// When creating new cuties _from is 0x0, but we cannot account that address.
82
if (_from != address(0)) {
83
ownershipTokenCount[_from]--;
84
// once the cutie is transferred also clear breeding allowances
85
delete sireAllowedToAddress[_cutieId];
86
// clear any previously approved ownership exchange
87
delete cutieIndexToApproved[_cutieId];
88
}
89
// Emit the transfer event.
90
emit Transfer(_from, _to, _hexId);
91
}
92
​
93
/// @dev For transferring a hex owned by this contract to the specified address.
94
/// Used to rescue lost hexs. (There is no "proper" flow where this contract
95
/// should be the owner of any Hex. This function exists for us to reassign
96
/// the ownership of Cuties that users may have accidentally sent to our address.)
97
/// @param _cutieId - ID of hex
98
/// @param _recipient - Address to send the cutie to
99
function restoreCutieToAddress(uint40 _cutieId, address _recipient) public onlyOperator whenNotPaused {
100
require(_isOwner(this, _cutieId));
101
_transfer(this, _recipient, _hexId);
102
}
103
​
104
address ownerAddress;
105
address operatorAddress;
106
​
107
bool public paused = false;
108
​
109
modifier onlyOwner()
110
{
111
require(msg.sender == ownerAddress);
112
_;
113
}
114
​
Copied!
Copy link