Personality value: Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
Actually I think that'd be helpful.
m (Undo revision 351572 by Reuvens (Talk))
(Actually I think that'd be helpful.)
Line 106: Line 106:
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 byte of ''a'' ≠ ''b'', ''c'' is true." In other words, 11010101 xor 01101010 = 10111101 . Each xor in the operation is a bitwise xor.
A bitwise {{wp|exclusive or}} (''xor'') operation (such as ''a'' xor ''b'' = ''c'') is equivalent to saying "If each byte of ''a'' ≠ ''b'', ''c'' is true." In other words, 11010101 xor 01101010 = 10111101. Each xor in the operation is a bitwise xor.


''E'' = ''ID<sub>Trainer</sub>'' xor ''ID<sub>Secret</sub>''
''E'' = ''ID<sub>Trainer</sub>'' xor ''ID<sub>Secret</sub>''
Line 113: Line 113:


''E'' xor ''F'' <= 8 , then ''Shiny''
''E'' xor ''F'' <= 8 , then ''Shiny''
===Example===
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>Secret</sub>'' = 38834 = 1001011110110010 in binary.
This trainer encounters a Pokémon whose personality value is 2814471828.
''p'' = 2814471828 = 1010011111000001 0110111010010100 in binary.
''p1'' = 1010011111000001
''p2'' = 0110111010010100
The ''E'' value is 0101111011100110 xor 1001011110110010
''E'' = 1100100101010100
The ''F'' value is 1010011111000001 xor 0110111010010100
''F'' = 1100100101010101
''E'' xor ''F'' = 0000000000000001, which is less than eight.  Therefore, this Pokémon is shiny.


==Spinda's spots==
==Spinda's spots==
55,887

edits

Navigation menu