ocean monument seeds

This commit is contained in:
Cubitect 2018-03-30 13:36:52 +02:00
parent b6a9b2d2b3
commit 2521de3f16
2 changed files with 490 additions and 7 deletions

274
finders.c
View File

@ -139,6 +139,7 @@ int isQuadTempleBase(const long seed, const long lower, const long upper)
return 1;
}
int isTriTempleBase(const long seed, const long lower, const long upper)
{
// seed offsets for the regions (0,0) to (1,1)
@ -187,13 +188,269 @@ int isTriTempleBase(const long seed, const long lower, const long upper)
return 1;
}
long moveTemple(const long baseSeed, const int regionX, const int regionZ)
{
return (baseSeed - regionX*341873128712 - regionZ*132897987541) & 0xffffffffffff;
}
int isQuadMonumentBase(const long seed, const int qual)
{
// seed offsets for the regions (0,0) to (1,1)
const long reg00base = 10387313;
const long reg01base = 341873128712 + 10387313;
const long reg10base = 132897987541 + 10387313;
const long reg11base = 341873128712 + 132897987541 + 10387313;
long s, p;
/*
seed = regionX*341873128712 + regionZ*132897987541 + seed + 10387313;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.x = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.x += (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.z = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.z += (seed >> 17) % 27;
*/
s = (reg00base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (reg01base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (reg10base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
s = (reg11base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) return 0;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) return 0;
return 1;
}
int isTriMonumentBase(const long seed, const int qual)
{
// seed offsets for the regions (0,0) to (1,1)
const long reg00base = 10387313;
const long reg01base = 341873128712 + 10387313;
const long reg10base = 132897987541 + 10387313;
const long reg11base = 341873128712 + 132897987541 + 10387313;
long s, p;
int incomplete = 0;
/*
seed = regionX*341873128712 + regionZ*132897987541 + seed + 10387313;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.x = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.x += (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.z = (seed >> 17) % 27;
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.z += (seed >> 17) % 27;
*/
s = (reg00base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp11;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp11;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp11;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp11;
if(0)
{
incomp11:
incomplete = 1;
}
s = (reg01base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp01;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp01;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp01;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp01;
if(0)
{
incomp01:
if(incomplete) return 0;
incomplete = 2;
}
s = (reg10base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p < 26-qual) goto incomp10;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p < 2*26-qual) goto incomp10;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp10;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp10;
if(0)
{
incomp10:
if(incomplete) return 0;
incomplete = 3;
}
s = (reg11base + seed) ^ 0x5DEECE66DL; // & 0xffffffffffff;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp00;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp00;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p = (s >> 17) % 27;
if(p > qual) goto incomp00;
s = (s * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
p += (s >> 17) % 27;
if(p > qual) goto incomp00;
if(0)
{
incomp00:
if(incomplete) return 0;
incomplete = 4;
}
return incomplete ? incomplete : -1;
}
// Searches for the optimal AFK position given four structures at positions 'p',
// each of volume (ax,ay,az).
// Returned is the number of spawning spaces in reach.
int countBlocksInSpawnRange(Pos p[4], const int ax, const int ay, const int az)
{
int minX = 3e7, minZ = 3e7, maxX = -3e7, maxZ = -3e7;
int best;
// Find corners
for(int i = 0; i < 4; i++)
{
if(p[i].x < minX) minX = p[i].x;
if(p[i].z < minZ) minZ = p[i].z;
if(p[i].x > maxX) maxX = p[i].x;
if(p[i].z > maxZ) maxZ = p[i].z;
}
// assume that the search area is bound by the inner corners
maxX += ax;
maxZ += az;
best = 0;
double thsq = 128.0*128.0 - az*az/4.0;
for(int x = minX; x < maxX; x++)
{
for(int z = minZ; z < maxZ; z++)
{
int inrange = 0;
for(int i = 0; i < 4; i++)
{
double dx = p[i].x - (x+0.5);
double dz = p[i].z - (z+0.5);
for(int px = 0; px < ax; px++)
{
for(int pz = 0; pz < az; pz++)
{
double ddx = px + dx;
double ddz = pz + dz;
inrange += (ddx*ddx + ddz*ddz <= thsq);
}
}
}
if(inrange > best)
{
best = inrange;
}
}
}
return best;
}
long *loadSavedSeeds(const char *fnam, long *scnt)
{
FILE *fp = fopen(fnam, "r");
@ -506,7 +763,7 @@ Pos getOceanMonumentPos(long seed, const long regionX, const long regionZ)
// set seed
seed = regionX*341873128712 + regionZ*132897987541 + seed + 10387313;
seed = (seed ^ 0x5DEECE66DL);// & ((1L << 48) - 1);
seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1);
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.x = (seed >> 17) % 27;
@ -518,8 +775,10 @@ Pos getOceanMonumentPos(long seed, const long regionX, const long regionZ)
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.z += (seed >> 17) % 27;
pos.x = regionX*512 + (pos.x << 3) + 8;
pos.z = regionZ*512 + (pos.z << 3) + 8;
pos.x = regionX*32 + (pos.x >> 1);
pos.z = regionZ*32 + (pos.z >> 1);
pos.x = pos.x*16 + 8;
pos.z = pos.z*16 + 8;
return pos;
}
@ -549,8 +808,10 @@ Pos getMansionPos(long seed, const long area80X, const long area80Z)
seed = (seed * 0x5DEECE66DL + 0xBL) & 0xffffffffffff;
pos.z += (seed >> 17) % 60;
pos.x = area80X*1280 + (pos.x << 3) + 8;
pos.z = area80Z*1280 + (pos.z << 3) + 8;
pos.x = area80X*80 + (pos.x >> 1);
pos.z = area80X*80 + (pos.z >> 1);
pos.x = pos.x*16 + 8;
pos.z = pos.z*16 + 8;
return pos;
}
@ -769,7 +1030,6 @@ int areBiomesViable(
}
map = cache ? cache : allocCache(layer, width, height);
genArea(layer, map, x1, z1, width, height);
for(i = 0; i < width*height; i++)

223
seeds/quadMonuments.txt Normal file
View File

@ -0,0 +1,223 @@
10697299265738628
137642513762244484
240943830215055236
249106604539664260
323415998391277444
359444795410241412
386466393174464388
529455681343477636
635290272586684292
665408095094724484
733806514435413892
903254450415228804
977000894313420676
1067917311790962564
1089590884997683076
1241305897444726660
1308015466925152132
1372473236591892356
1391050585054795652
1485344702252865412
1516306949691037572
1591742243449493380
1610882541865817988
1615104666516477828
1648318713768335236
1662110987627157380
1751901505197856644
1790182102030505860
1798907826308536196
1841129072815134596
1905305367505164164
2014799133445609348
2091078852134197124
2108811775666968452
2243638289511372676
2443766997952649092
2698220376899082116
2783225819865700228
2956332930542753668
2960555055193413508
3020790700209493892
3311272876174890884
3312117301105022852
3410070593000331140
3424144341835863940
3465802638389041028
3495638985920370564
3542082357077628804
3555593155959740292
3632154349625038724
3674375596131637124
3758818089144833924
3910814576568588164
3962324497306638212
4038885690971936644
4199607902673721220
4289116945267709828
4438580157901068164
4530622475285452676
4569747497048233860
4642086566062872452
4742573132748576644
4861355572920473476
5066269355965831044
5089350304056104836
5206725369344448388
5281597713149482884
5295671461985015684
5349433182536750980
5549843365954738052
5738150125374166916
5804296744901171076
5851021591035139972
5860591740243302276
6083801396774852484
6161769965323704196
6249871633034139524
6317988577398118276
6432267417942644612
6818451085989664644
6844065308870334340
6857294632775735172
6895012279654963076
6972136423273682820
6988743446899611524
7028994368569235332
7080785764283996036
7199005254502471556
7262900074215790468
7353253541739911044
7392941513456113540
7417992786383361924
7464154682563909508
7501309379489716100
7633884093520435076
7691023513792698244
7831479527171315588
7971935540549932932
8049622634122073988
8092406830582093700
8196552571965036420
8214848445451229060
8266358366189279108
8430458277611591556
8456072500492261252
8634809110703527812
8643253360004847492
8724036678320805764
8762317275153454980
8763443175060297604
8764006125013718916
8841693218585859972
8949498134666041220
8961601558664599428
9050829126281877380
9082635798650181508
9170174516407195524
9214084612774057860
-9204511963264428156
-8996783430451964028
-8971169207571294332
-8961880533339842684
-8915155687205873788
-8893200639022442620
-8810165520892799100
-8754996425457510524
-8584141114594142332
-8530942343995828348
-8500261571534366844
-8360649983085881468
-8182194847851325564
-7939844892903450748
-7924363769184364668
-7685954463910439036
-7519321277697730684
-7281474922377226364
-7279786072516962428
-7267682648518404220
-7242912850567866492
-7015481069385656444
-7010695994781575292
-6798745337318451324
-6649282124685092988
-6456753240615004284
-6422694768433014908
-6391451046018132092
-6366962723044305020
-6263661406591494268
-6111383444191029372
-6094494945588390012
-6082391521589831804
-6077606446985750652
-6027785376107964540
-5909002935936067708
-5711970452238608508
-5642727607967787132
-5565603464349067388
-5512686168727464060
-5509308469006936188
-5380392929673455740
-5302705836101314684
-5278498988104198268
-5266395564105640060
-5223892842622331004
-5193775020114290812
-5113554651751753852
-4630543591716268156
-4398045260953266300
-4379749387467073660
-4350475989889165436
-4290240344873085052
-4271381521433471100
-4217338325905025148
-4087015411687991420
-4074067562759301244
-4002572918674794620
-3996661944163870844
-3960633147144906876
-3854235605948278908
-3841006282042878076
-3560657205239064700
-3558123930448668796
-3455667038925990012
-3421890041720711292
-3361935871681341564
-3238086881928652924
-3160962738309933180
-3073142545576208508
-3029795399162767484
-2909324109130606716
-2706099175945513084
-2616308658374813820
-2417868799793801340
-2297960459715061884
-2197473893029357692
-2067150978812323964
-2042099705885075580
-1950338863477401724
-1841689522467088508
-1739232630944409724
-1710522183319922812
-1664641762116085884
-1660138162488715388
-1659856687512004732
-1644375563792918652
-1602717267239741564
-1490127276555479164
-1487875476741793916
-1445935705211906172
-1268043519930771580
-1173186452779280508
-1056937287397779580
-883267226767304828
-813742907519772796
-558445103643207804
-532267930809116796
-454299362260265084
-332139222367840380
-324820872973363324
-281192251583211644
-211386457358968956
-188024034291984508