mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-01 03:39:16 +00:00
size_known() does not ensure known trees -- added trees_known(), also implemented special Yendor generation for binary and bitruncated a4(<4)
This commit is contained in:
parent
c294c9f6c5
commit
65fabe89c6
@ -361,6 +361,10 @@ bool sizes_known() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool trees_known() {
|
||||||
|
return sizes_known() && !(BITRUNCATED && a4 && S7 <= 5);
|
||||||
|
}
|
||||||
|
|
||||||
string expansion_analyzer::approximate_descendants(int d, int max_length) {
|
string expansion_analyzer::approximate_descendants(int d, int max_length) {
|
||||||
auto t = SDL_GetTicks();
|
auto t = SDL_GetTicks();
|
||||||
while(isize(descendants) <= d && SDL_GetTicks() < t + 100)
|
while(isize(descendants) <= d && SDL_GetTicks() < t + 100)
|
||||||
|
38
yendor.cpp
38
yendor.cpp
@ -166,6 +166,8 @@ namespace yendor {
|
|||||||
nyi.howfar = 0;
|
nyi.howfar = 0;
|
||||||
|
|
||||||
generating = true;
|
generating = true;
|
||||||
|
|
||||||
|
int turns = 0;
|
||||||
|
|
||||||
if(true) {
|
if(true) {
|
||||||
int t = -1;
|
int t = -1;
|
||||||
@ -212,19 +214,37 @@ namespace yendor {
|
|||||||
ycw += best;
|
ycw += best;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(sizes_known()) {
|
else if(binarytiling) {
|
||||||
|
// make it challenging
|
||||||
|
vector<int> ds;
|
||||||
|
for(int d=0; d<ycw.at->type; d++) {
|
||||||
|
if(celldist((ycw+d).cpeek()) < celldist(ycw.at))
|
||||||
|
ds.push_back(d);
|
||||||
|
}
|
||||||
|
if(isize(ds)) ycw += ds[hrand(isize(ds))];
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(trees_known()) {
|
||||||
if(i == 0) {
|
if(i == 0) {
|
||||||
t = type_in(expansion, yendor, [yendor] (cell *c) { return celldistance(yendor, c); });
|
t = type_in(expansion, yendor, [yendor] (cell *c) { return celldistance(yendor, c); });
|
||||||
bignum b = expansion.get_descendants(YDIST-1, t);
|
bignum b = expansion.get_descendants(YDIST-1, t);
|
||||||
full_id = hrand(b);
|
full_id = hrand(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG_YENDORGEN
|
||||||
|
printf("#%3d t%d %s / %s\n", i, t, full_id.get_str(100).c_str(), expansion.get_descendants(YDIST-1-i, t).get_str(100).c_str());
|
||||||
|
for(int tch: expansion.children[t]) {
|
||||||
|
printf(" t%d %s\n", tch, expansion.get_descendants(YDIST-2-i, t).get_str(100).c_str());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(i == 1)
|
if(i == 1)
|
||||||
onlychild = true;
|
onlychild = true;
|
||||||
if(!onlychild) ycw++;
|
if(!onlychild) ycw++;
|
||||||
if(S3 == 3) ycw++;
|
if(VALENCE == 3) ycw++;
|
||||||
|
|
||||||
onlychild = false;
|
onlychild = false;
|
||||||
|
|
||||||
for(int tch: expansion.children[t]) {
|
for(int tch: expansion.children[t]) {
|
||||||
ycw++;
|
ycw++;
|
||||||
if(i == 1)
|
if(i == 1)
|
||||||
@ -240,6 +260,18 @@ namespace yendor {
|
|||||||
else {
|
else {
|
||||||
// stupid
|
// stupid
|
||||||
ycw += rev;
|
ycw += rev;
|
||||||
|
// well, make it a bit more clever on bitruncated a4 grids
|
||||||
|
if(a4 && BITRUNCATED && S7 <= 5) {
|
||||||
|
if(ycw.at->type == 8 && ycw.cpeek()->type != 8)
|
||||||
|
ycw++;
|
||||||
|
if(hrand(100) < 10) {
|
||||||
|
if(euclid ? (turns&1) : (hrand(100) < 50))
|
||||||
|
ycw+=2;
|
||||||
|
else
|
||||||
|
ycw-=2;
|
||||||
|
turns++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inmirror(ycw)) ycw = mirror::reflect(ycw);
|
if(inmirror(ycw)) ycw = mirror::reflect(ycw);
|
||||||
|
Loading…
Reference in New Issue
Block a user