Personality value: Difference between revisions

From Bulbapedia, the community-driven Pokémon encyclopedia.
Jump to navigationJump to search
you need to do a bitwise xor, not a boolean xor. Also, the final value must be less than eight.
mNo edit summary
(you need to do a bitwise xor, not a boolean xor. Also, the final value must be less than eight.)
Line 104: Line 104:
Whether a Pokémon is [[alternate coloration|shiny]] or not depends on the values of the [[Trainer ID number]], [[secret ID number]], and personality value.
Whether a Pokémon is [[alternate coloration|shiny]] or not depends on the values of the [[Trainer ID number]], [[secret ID number]], and personality value.


{{wp|Boolean}} variables ''E'' and ''F'' are declared to hold the values that result.
Variables ''E'' and ''F'' are declared to hold the values that result.


An {{wp|exclusive or}} (''xor'') operation (such as ''a'' xor ''b'' = ''c'') is equivalent to saying "If ''a'' ≠ ''b'', ''c'' is true."  
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>''<!--If Trainer ID ≠ Secret ID, E is true. If Trainer ID = Secret ID, E is false.-->
''E'' = ''ID<sub>Trainer</sub>'' xor ''ID<sub>Secret</sub>''


''F'' = ''p<sub>1</sub>'' xor ''p<sub>2</sub>''<!--If first 16 digits ≠ last 16 digits, F is true. If first 16 digits = last 16 digits, F is false.-->
''F'' = ''p<sub>1</sub>'' xor ''p<sub>2</sub>''


''Shiny'' = ''E'' xor ''F''<!--Only happens if one of the two is false!-->
''E'' xor ''F'' <= 8 , then ''Shiny''


==Spinda's spots==
==Spinda's spots==
13

edits

Navigation menu