-
-
Save LegoFigure11/c497aefce6849d61252414d42682a263 to your computer and use it in GitHub Desktop.
Python implementation of wwwwwwzx's Gen 7 Magikarp Method Egg Seed solver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://github.com/wwwwwwzx/3DSRNGTool/blob/master/3DSRNGTool/Util/MagikarpCalc.cs | |
# MIT License | |
invlist = [ | |
2473900082, 2942504091, 3818669108, 1606527666, | |
1772516849, 3174816280, 683688538, 277162350, | |
473687804, 740538931, 3736879421, 835125771, | |
3151130313, 1776424681, 2916316050, 575335318, | |
3885816110, 2116212291, 4141956358, 708008661, | |
823646635, 3736594918, 3120921304, 784816472, | |
3366030512, 3882469154, 3488037232, 752048312, | |
624451139, 1398287391, 1029721010, 770413716, | |
1018556670, 879841532, 712647539, 762054526, | |
2610508113, 50304285, 3116021802, 757285885, | |
2923570824, 794104193, 1870515017, 1562607165, | |
213913665, 3737913320, 861924223, 818185013, | |
1749703937, 2837816915, 3260431184, 1266283868, | |
2012331341, 385053804, 2631067532, 1720507012, | |
2399487432, 509823408, 3336276253, 1075187703, | |
1755174278, 4202260471, 401384863, 854806887, | |
117832076, 1244737751, 3867891395, 2107748563, | |
1825531558, 2821190438, 799899723, 40378920, | |
91535201, 3966590345, 4092719438, 1900287555, | |
142908880, 2428594453, 4042839341, 1281809005, | |
989575564, 874922772, 237853366, 1758650419, | |
1342665097, 412170985, 1878138301, 946446765, | |
3504591644, 1125413999, 1860175504, 1025039160, | |
2500255679, 2335259963, 1352982241, 179375243, | |
1089117350, 3530218584, 3215437663, 354565024, | |
8592345, 1528631731, 3476679081, 1164300025, | |
1229107172, 1450554931, 2722277174, 1110953626, | |
3833382903, 191067075, 3406461685, 775272281, | |
1074480033, 2166892811, 824773512, 810401547, | |
2405166556, 4108578124, 78872491, 897376497, | |
2611178662, 1239191693, 1563762183, 917726769, | |
3188967975, 3540666864, 716535587, 1741755719, | |
3545033698, 2054665264, 1367377077, 554324700, | |
947375608, 1481077862, 3178791546, 1670251543, | |
2007293330, 3552849363, 1537664804, 1150670637, | |
3476664924, 4232424583, 3988945420, 1416017323, | |
1647293270, 3178222540, 1946875313, 1569632945, | |
2437093728, 3469971013, 2681107169, 1504096625, | |
1248902278, 2796574782, 2059442020, 1540827432, | |
2037113340, 1759683064, 1425295078, 1524109052, | |
926048930, 100608571, 1937076308, 1514571771, | |
3296655187, 3546706884, 863398360, 1645526104, | |
427827330, 3180859344, 1723848447, 1636370026, | |
1215168577, 3750173793, 1763805675, 1319217819, | |
1998176473, 2687154207, 3559403602, 357299499, | |
2263888339, 2970272678, 1614474608, 1484677069, | |
3510348556, 4109553646, 802769727, 1709613774, | |
2532395355, 430846313, 547050188, 588325253, | |
3651063116, 1347413580, 1599799447, 80757840, | |
2450773121, 1427565525, 174988759, 987393189, | |
2314437091, 2890826477, 209474833, 1084224761, | |
3977103707, 3850426095, 4057418278, 167215172, | |
2685330194, 824341970, 3756276602, 1892893530, | |
2714215992, 2250827999, 3720351008, 2050078320, | |
705544062, 375552631, 2705964483, 358750486, | |
2178234700, 2765469872, 2135908031, 709130049, | |
2583465457, 1006007201, 1946037272, 1385815505, | |
176153995, 556219553, 2835919142, 1547558167, | |
3371798510, 382134151, 2517956074, 1550544563, | |
2148960066, 38818326, 1649547025, 1620803094, | |
515365816, 3922188953, 157744983, 1794752994, | |
927390028, 2478383387, 3127524366, 1835453538, | |
1964359054, 1346034676, 2773909860, 700941478, | |
3839700493, 735626022, 3102150925, 401631916, | |
2795100102, 4109330529, 2734754154, 1108649400, | |
3893698993, 1027782667, 2541550526, 525223949, | |
2008220005, 709102433, 1522544899, 1366945400, | |
109698811, 1967589832, 906562387, 1889479541, | |
1554373869, 4145280863, 93852713, 1666131264, | |
3128723585, 275467340, 3524336265, 1797202625, | |
203146061, 3232555195, 403493251, 1878790770, | |
1781365177, 1544098615, 1147499142, 1843551706, | |
4137582343, 2251424945, 191307746, 1826574292, | |
268915941, 721467214, 2338401531, 477837458, | |
2885352263, 4143730535, 552751797, 457198838, | |
136755907, 851601413, 1070525597, 1158747412, | |
3996352946, 1079341118, 2823839909, 714598999, | |
2501564901, 4024031114, 771237291, 1756299192, | |
982379611, 1680461594, 2990500149, 329188798, | |
769823414, 861692627, 1094100376, 1176650506, | |
3007158936, 2694827161, 3199598894, 161515680, | |
606578946, 2855131051, 349977518, 1974786378, | |
2333981061, 3578877212, 4118107497, 1500359120, | |
3659240116, 3405884895, 3819869261, 334430345, | |
3639049317, 4018715490, 1380288958, 972342935, | |
3681941041, 2174583160, 1443751179, 741420227, | |
1411088124, 751105262, 1116961670, 717500973, | |
61502106, 1235972449, 4271816063, 1418260098, | |
2869141923, 4196448132, 175220602, 2103573376, | |
2349166935, 3481414021, 3214712070, 1613363725, | |
151627165, 2688655304, 3248755870, 1619303749, | |
2564273351, 2305619178, 690606440, 426032142, | |
2778008883, 1581508085, 4282384869, 228705254, | |
4134996187, 2864583409, 2572781399, 44030183, | |
3928718110, 2692069352, 1252852424, 1401882957, | |
1, 0, 0, 0, | |
3384433691, 1471252045, 1909334554, 803263833, | |
2399662560, 2629831378, 970820529, 744125624, | |
1092768064, 3754258272, 1688169390, 1248988627, | |
738259208, 885499746, 404872949, 2087045765, | |
2031267564, 3083270710, 1148220857, 1703938405, | |
847006446, 913105124, 3349198489, 1747865903, | |
578670128, 2053355957, 3972263609, 1850521331, | |
2125583562, 268241833, 90017996, 1831731184, | |
1468567086, 2819963541, 2267829336, 1823652772, | |
363162750, 4099622620, 2679817004, 1818841925, | |
2249959179, 3340825919, 1535173577, 1411368137, | |
3596033508, 2251742675, 2742303311, 1295203879, | |
1958457448, 3596592091, 3921313929, 96698672, | |
1528154909, 3356264983, 1323067591, 400362618, | |
2668236031, 3995697128, 3101118453, 301039348, | |
3201968686, 409582246, 3362395725, 106945160, | |
4233350850, 584829829, 1435638997, 1459112914, | |
645200406, 3532961495, 1516108368, 886087888, | |
3752981930, 1008493437, 3454359604, 1816374276, | |
1090702313, 861940306, 1594889588, 120099015, | |
3296730094, 2799302710, 4103433748, 774330099, | |
1753424047, 938918950, 3820525977, 1911406474, | |
2747315801, 1464726844, 3459912739, 1345512790, | |
1039859072, 2167202280, 3918542128, 1980369378, | |
4151342478, 2151339220, 1513485344, 481681366, | |
3917053545, 630242658, 1721643573, 615328433, | |
3335491080, 1286254886, 2848112514, 2034859771, | |
958332647, 1560750903, 1067855707, 1064332801, | |
912629385, 1358559522, 2785159069, 452496319, | |
907929832, 3094959793, 1656824911, 882836262, | |
885899102, 4214721172, 735070359, 1456444715 | |
] | |
def calc(inlist): | |
l = [0, 0, 0, 0] | |
for k in range(4): | |
t = 1 | |
for i in range(32): | |
if i + k * 32 == 127: | |
break | |
if inlist[i + k * 32] == '1': | |
l[k] ^= t | |
t <<= 1 | |
res = mul(l) | |
print(f"{res[3]:08X}, {res[2]:08X}, {res[1]:08X}, {res[0]:08X}") | |
def mul(vec): | |
tarr = [0, 0, 0, 0] | |
result = [0, 0, 0, 0] | |
t = 1 | |
c = 0 | |
for i in range(127): | |
if i == 31 or i == 63 or i == 95: | |
t = 1 | |
c += 1 | |
for k in range(4): | |
tarr[k] = invlist[(i * 4) + k] & vec[k] | |
while tarr[k] > 0: | |
if (tarr[k] & 1) == 1: | |
result[c] ^= t | |
tarr[k] >>= 1 | |
t <<= 1 | |
return result | |
if __name__ == '__main__': | |
instr = input("Please enter the string of 0's and 1's: ") | |
instr = list(instr) | |
if len(instr) != 127: | |
print(f"Incorrect number of inputs provided! (Got {len(instr)}, expected 127)") | |
else: | |
calc(instr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment