2
edits
m (→Shininess: Formatted math a bit nicer.) |
|||
Line 160: | Line 160: | ||
==Shininess== | ==Shininess== | ||
<code><span style="background:#FF9999">00000000 00000000</span> <span style="background:#9999FF">00000000 00000000</span></code> | <code><span style="background:#FF9999">00000000 00000000</span> <span style="background:#9999FF">00000000 00000000</span></code> | ||
:The <span style="background:#FF9999">red value</span> will be represented as ''p<sub>1</sub> | :The <span style="background:#FF9999">red value</span> will be represented as ''p''<sub>1</sub>, while the <span style="background:#9999FF">blue value</span> will be represented as ''p''<sub>2</sub>. | ||
Whether a Pokémon is {{Shiny}} or not depends on the values of the [[Trainer ID number]], [[secret ID number]], and personality value. There is an [[Shiny Pokémon#Generations III and IV|8 in 65536 chance]] (0.012207% or 2<sup> | Whether a Pokémon is {{Shiny}} or not depends on the values of the [[Trainer ID number]], [[secret ID number]], and personality value. There is an [[Shiny Pokémon#Generations III and IV|8 in 65536 chance]] (0.012207% or 2<sup>−13</sup>) of a Pokémon being Shiny (which simplifies to 1/8192). | ||
Variables ''E'' and ''F'' are declared to hold the values that result. | Variables ''E'' and ''F'' are declared to hold the values that result. | ||
A bitwise {{wp|exclusive or}} ( | A bitwise {{wp|exclusive or}} operation (or "xor," written as in ''a'' ⊻ ''b'' = ''c'') means "for each bit of ''a'' and ''b'', that bit of ''c'' is 1 if they are different and 0 if they are the same."' For example, 1100<sub>2</sub> ⊻ 1010<sub>2</sub> = 0110<sub>2</sub>. It could also be read as "take ''a'', and flip each bit if the corresponding bit of ''b'' is 1." The operation is commutative, so it doesn't matter what order the variables go in. | ||
'' | :''S'' = ''ID<sub>Trainer</sub>'' ⊻ ''ID<sub>Secret</sub>'' ⊻ ''p''<sub>1</sub> ⊻ ''p''<sub>2</sub> | ||
'' | If ''S'' < 8, then the Pokémon is shiny. | ||
===Example=== | ===Example=== | ||
As an example, let's take a Trainer whose Trainer ID is 24294 and whose Secret ID is 38834. | As an example, let's take a Trainer whose Trainer ID is 24294 and whose Secret ID is 38834. | ||
''ID<sub>Trainer</sub>'' = 24294 = 0101111011100110 | :''ID<sub>Trainer</sub>'' = 24294<sub>10</sub> = 0101111011100110<sub>2</sub> | ||
:''ID<sub>Secret</sub>'' = 38834<sub>10</sub> = 1001011110110010<sub>2</sub> | |||
''ID<sub>Secret</sub>'' = 38834 = 1001011110110010 | |||
This Trainer encounters a Pokémon whose personality value is 2814471828. | This Trainer encounters a Pokémon whose personality value is 2814471828. | ||
''p'' = 2814471828 = 1010011111000001 0110111010010100 | :''p'' = 2814471828<sub>10</sub> = 1010011111000001<span style="margin-left:0.2em">0110111010010100</span><sub>2</sub> | ||
:''p''<sub>1</sub> = 1010011111000001<sub>2</sub> | |||
'' | :''p''<sub>2</sub> = 0110111010010100<sub>2</sub> | ||
'' | |||
'' | The ''S'' value is then all of these values XOR'd together. | ||
:''S'' = 0101111011100110<sub>2</sub> ⊻ 1001011110110010<sub>2</sub> ⊻ 1010011111000001<sub>2</sub> ⊻ 0110111010010100<sub>2</sub> | |||
:''S'' = 0000000000000001<sub>2</sub> | |||
'' | ''S'' is less than 8 in this case, so this Pokémon is Shiny. | ||
==Characteristic== | ==Characteristic== |
edits