Pokémon Gold Version, Silver Version, and Crystal Version - Magikarp’s Length
The size of a Magikarp in Pokémon Gold Version, Pokémon Silver Version, and Pokémon Crystal Version is calculated in two steps. First, the game calculates two numbers called B and C as follows.
B=RRC(RRC(AT * 16 + DF)) xor RRC(V)
C=RRC(RRC(SP * 16 + SC)) xor RRC(W)
- V is the Pokémon’s ID divided by 256 and rounded down (the high byte of the ID).
- W is the remainder of the Pokémon’s ID divided by 256 (the low byte of the ID).
- AT is the Attack diversification value (DV, individual value).
- DF is the Defense DV.
- SP is the Speed DV.
- SC is the Special DV.
-
"xor" is an "exclusive OR" operation:
- Let A and B be the two numbers on either side of the "xor", let C be 1, and let R be 0.
- If A is odd and B is even, or vice versa, add C to R.
- Multiply C by 2, and divide A and B each by 2, rounding down.
- Repeat steps 2 and 3 until A and B are both 0.
- The result of the "exclusive or" operation is R.
- "RRC" is a right rotate carry operation performed on bytes. It is equivalent to dividing the value by 2, rounding down, and adding 128 to the result if the original value is odd.
Then the game figures out the size based on the values of B and C. There are two special cases here. If B is 0 and C is less than 10, then the size is equal to C plus 190 millimeters. Otherwise, if B is 255, then the size is equal to C plus 1370 millimeters. Otherwise, the size in millimeters is determined using the following formula:
Size = Z * 100 + int(((65536+(B * 256 + C)-X)%65536)/Y) % 256
where "%" is the remainder operator, and where X, Y, and Z depend on the value of B as follows:
- If B is 0, then X = 310, Y = 2, Z = 3.
- If B is 1, then X = 710, Y = 4, Z = 4.
- If B is 2 through 9, then X = 2710, Y = 20, Z = 5.
- If B is 10 through 29, then X = 7710, Y = 50, Z = 6.
- If B is 30 through 68, then X = 17710, Y = 100, Z = 7.
- If B is 69 through 126, then X = 32710, Y = 150, Z = 8.
- If B is 127 through 185, then X = 47710, Y = 150, Z = 9.
- If B is 186 through 224, then X = 57710, Y = 100, Z = 10.
- If B is 225 through 243, then X = 62710, Y = 50, Z = 11.
- If B is 244 through 251, then X = 64710, Y = 20, Z = 12.
- If B is 252 through 253, then X = 65210, Y = 5, Z = 13.
- If B is 254, then X = 65410, Y = 2, Z = 14.
When the value is converted to inches (1 inch = 25.4 mm), it’s rounded down to the nearest inch.