Last active
June 16, 2022 18:59
-
-
Save Lusamine/c73bd2b4ed5a5548bb53a7d0c1b48aee to your computer and use it in GitHub Desktop.
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
bool lure_active = true; | |
string output = ""; | |
void Main() | |
{ | |
// Initial state | |
ulong s0 = 0x0123456789ABCDEF; | |
ulong s1 = 0x0123456789ABCDEF; | |
// Set this for how far you want to search. | |
int maxAdvance = 1000; | |
var rng = new Xoroshiro128Plus(s0, s1); | |
for (int advances = 0; advances < maxAdvance; advances++) | |
{ | |
var (_s0, _s1) = rng.GetState(); | |
output = $"{advances:00000} | {_s0:x16} | {_s1:x16} |"; | |
GetStateLGPEBird(advances, rng, 1); | |
rng.Next(); | |
} | |
} | |
// You can define other methods, fields, classes and namespaces here | |
private void GetStateLGPEBird(int advance, Xoroshiro128Plus rng, int try_no) | |
{ | |
if (try_no is not (1 or 2)) | |
return; | |
var check = rng.Next(); | |
var rand = (uint)(check % 10000); | |
ulong bird = 0; | |
if (rand <= 4) | |
{ | |
output += $" Bird generated on try #{try_no}! | {rand} | "; | |
bird = (uint)(rng.Next() % 3); | |
switch (bird) | |
{ | |
case 0: | |
output += "Moltres"; | |
break; | |
case 1: | |
output += "Zapdos"; | |
break; | |
case 2: | |
output += "Articuno"; | |
break; | |
} | |
} | |
else if (lure_active && try_no != 2) // Active lure gives a second try. | |
{ | |
GetStateLGPEBird(advance, rng, 2); | |
return; | |
} | |
// Add your filters here. | |
if (rand > 4) | |
return; | |
if (bird != 1) // Zapdos only. | |
return; | |
Console.WriteLine(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment