Personality value: Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
m
→‎Shininess: Formatted math a bit nicer.
m (Undo revision 2009469 by TortiOisi (talk) Same as other undo)
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>'', while the <span style="background:#9999FF">blue value</span> will be represented as ''p<sub>2</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>-13</sup>) of a Pokémon being Shiny (which simplifies to 1/8192).
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}} (''xor'') operation (such as ''a'' xor ''b'' = ''c'') is equivalent to saying "If each bit of ''a'' ''b'', ''c'' is true." In other words, 11010111 xor 01101010 = 10111101. Each xor in the operation is a bitwise xor.
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.


''E'' = ''ID<sub>Trainer</sub>'' xor ''ID<sub>Secret</sub>''
:''S'' = ''ID<sub>Trainer</sub>'' ''ID<sub>Secret</sub>'' ⊻ ''p''<sub>1</sub> ⊻ ''p''<sub>2</sub>


''F'' = ''p<sub>1</sub>'' xor ''p<sub>2</sub>''
If ''S'' < 8, then the Pokémon is shiny.
 
''E'' xor ''F'' < 8 , then ''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 in binary.
:''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 in binary.


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 in binary.
:''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>
''p1'' = 1010011111000001
:''p''<sub>2</sub> = 0110111010010100<sub>2</sub>
 
''p2'' = 0110111010010100
 
 
The ''E'' value is 0101111011100110 xor 1001011110110010
 
''E'' = 1100100101010100
 
The ''F'' value is 1010011111000001 xor 0110111010010100


''F'' = 1100100101010101
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>


''E'' xor ''F'' = 0000000000000001, which is less than eight. Therefore, this Pokémon is Shiny.
''S'' is less than 8 in this case, so this Pokémon is Shiny.


==Characteristic==
==Characteristic==
2

edits

Navigation menu