Possible Gen 3 Shiny Mismatch?
Posted by: adamboy7
Date: 2020-04-23 23:04:24
I wrote a program that takes in your ID, SID, and the personality value of your desired shiny-ified pokemon. It seems to be working great so far! So I decided to go a step further and see if I could brute force shiny PID's. It basically starts at PID of 0 , checks against your ID/SID, increments and repeats until it reaches the maximum value of 4294967295. Code found here, python 3:
Max = 4294967295
ID = 3020
SID = 39106
PID = 0
Shiny = 0
TID_XOR = ID ^ SID
list = open(str(ID) + " " + str(SID) + ".txt", "w")
list.write(str(ID) + " " + str(SID) + ":")
while PID <= Max:
PID1 = int(bin(PID)[2:].zfill(32)[:16], 2)
PID2 = int(bin(PID)[2:].zfill(32)[16:], 2)
PID_XOR = PID1 ^ PID2
if TID_XOR ^ PID_XOR <= 8:
Shiny = Shiny + 1
print (Shiny)
list.write("\n" + hex(PID)[2:].zfill(8))
PID = PID + 1
exit()
The game is Fire Red, my ID is 03020, my secret ID is 39106. Everything seems to have run correctly, I got 589824 shiny PID's. I tried a good number in PKHex and they're all shiny, with the exception of the first value it generated. Why isn't it shiny? The PID is 00009306 (Hex).
I did the math by hand and XORing everything works out to exactly 8 and should therefore be shiny. But neither in game nor in PKHex is my pokemon shiny. The math works out and it should be within hypothetical range of a valid PID, so why isn't it shiny? It's a silly thought experiment in the end anyways, but any insight is greatly appreciated. Thanks, Adam.
Math:
00000000000000001001001100000110 PID (37638)
0000101111001100 ID (3020)
1001100011000010 SID (39106)
1001001100001110 TID XOR (37646)
0000000000000000 PID1 (0)
1001001100000110 PID2 (37638)
1001001100000110 PID XOR (37638)
1001001100000110 PID XOR (37638)
1001001100001110 TID XOR (37646)
0000000000001000 Shiny Value (8)
Shiny Calculation from Bulbepedia:
https://bulbapedia.bulbagarden.net/wiki/Personality_value#Shininess
Link to my pk3 file:
http://www.mediafire.com/file/tdgrc9zmiviee3i/008_-_Larxene_-_61DB00009306.pk3/file
Link to my brute forced PID list:
http://www.mediafire.com/file/omzcmg22c9nuqqe/3020_39106.txt/file
Edit: Found the answer, it has to be less than 8, not less than or equal to for gen 3. My bad :P