Breaking Down The Math of Ape Builder

The Isles of Motu
The Isles of Motu
4 min readApr 7, 2021

--

Here on Ape Island, we have a very large number of different apes, 262,144 to be exact. When you come to the Ape Builder to generate an ape, you have the chance to create one of the five different classes of apes: Pure, Mythic, Legend, Rare and Common. But, what are the probabilities behind each of these results? This post is here to answer this question.

As you can see, each ape has six defined parts: Head, right and left arms, torso and two legs. As well as eight Season 2 materials: Wood, Rich, Nebula, Chadium12, Gold, Liberty, Orang and Chimp. Each ape is created from these materials.

Ape Visualization

It helps here to visualize apes in a less fancy manner. In the image below, we have ape bodies consisting of 6 parts and 8 different colors.

This image shows 100 randomly generated apes. See how most bodies have a mix of different materials?

We can see some that have 3 parts of the same color, many with 2 of the same, but there are no Pure bodies in this sample.

Note the first body in the image (top left hand corner). This one has 2–2–1–1, that is, two colors are the same twice, and one of each color for the remaining two parts. This case is what we consider Common because it has a maximum of two parts repeated.

We could also have the case of a body that is 3–2–1, this would be a Rare ape, as the maximum here is 3 repeated colors. However, this could also be accounted for as a Common ape, as it has 2 repeated colors as well. To arrive at precise probabilities we had to put some rules in place.

The rule that decides the class of the ape is the maximum number of repeated colors. That is, in the case of the 3–2–1 body, this would only be considered a Rare ape and we eliminate the possibility of it being accounted for as a Common ape as well.

By doing this, we can arrive at the total number of each class. Then, we just need to draw their probabilities against the total number of potential ape combinations.

Here is how this rule looks like visually:

In this table, each possible color is defined with a number, so we have 1–8 to represent the 8 different colors.

Then we generated all 262,144 possibilities; these are also known as tuples.

For each tuple, we group like numbers, i.e., same colors (e.g., 1 = Red, 2 = Green, etc.).

The first column represents a tuple.

The second column represents the grouped data (this would be considered a verification).

The third column counts the number of members in each grouping in the second column.

Column 4 takes the max group size, and this gives name to the bucket.

Then we just count how many are in each bucket according to the 4th column, and divide that number by 262,144 (total number of combinations).

Visualizing these random samplings helps verify that things went according to plan.

Case Output

Here is the output for this case:

Total Combinations: 262,144

Number of parts with max same materials:

1 Part= 20,160

2 Parts= 181,440

3 Parts= 54,320

4 Parts= 5,880

5 Parts= 336

6 Parts= 8

The first item means the number where all parts have a different material. The second item means the number where no more than 2 parts have the same material, but there was at least one case where 2 shared material. And so on.

These are the probabilities we arrive at, respectively:

1 Part= 0.0769042970

2 Parts= 0.6921386719

3 Parts= 0.2072143555

4 Parts= 0.0224304199

5 Parts= 0.0012817383

6 Parts= 0.0000305175

In Season 2 we grouped the cases for 1 of the same and 2 of the same (meaning, no materials repeated and 2 materials repeated) as Common apes. In subsequent seasons we may create a new class to separate these two.

About Ape In

Ape In is an NFT-driven experience that features a series of mini-games that are designed to offer a consumer-friendly approach to decentralized finance (DeFi). These games function to introduce crypto-centric concepts such as farming and vaulting to a broader audience while forwarding the industry’s thinking around the utility of NFTs.

--

--