1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-29 19:40:35 +00:00

dynamic-wfc: animation

This commit is contained in:
Zeno Rogue 2022-06-08 18:03:32 +02:00
parent fd5458eaed
commit 4d3a9081a9

View File

@ -18,6 +18,8 @@ namespace hr {
namespace dynamic_wfc { namespace dynamic_wfc {
bool animated = false;
vector<cell*> generate_pd_list(celllister& cl) { vector<cell*> generate_pd_list(celllister& cl) {
cell *croot = cl.lst.back(); cell *croot = cl.lst.back();
@ -117,6 +119,12 @@ vector<cell*> global_list;
int wfctype, wfcrad, cutoff; int wfctype, wfcrad, cutoff;
void wfc_clear() {
trans.clear();
ctf.clear();
global_list.clear();
}
void wfc_build() { void wfc_build() {
int code_at = trans.back().news; int code_at = trans.back().news;
int cpos = isize(ctf); int cpos = isize(ctf);
@ -280,9 +288,23 @@ void wfc() {
long long tfreq = 0; long long tfreq = 0;
if(animated)
for(int j=0; j<ls; j++)
for(auto& nns: new_neighborhoods[j]) for(auto c: nns) c->landparam = 0x202020;
for(int i=0; i<ls; i++) if(consider.count(l[i])) { for(int i=0; i<ls; i++) if(consider.count(l[i])) {
tfreq += isize(freq); tfreq += isize(freq);
println(hlog, i, "/", ls, ": freqs = ", isize(freq), " inpath ", isize(inpath)); string s = lalign(0, i, "/", ls, ": freqs = ", isize(freq), " inpath ", isize(inpath));
println(hlog, s);
if(animated) {
for(int j=0; j<i; j++)
for(auto& nns: new_neighborhoods[j]) for(auto c: nns) c->landparam = multiplicity[c] ? 0xFFFF00 : 0x00FF00;
for(auto& nns: new_neighborhoods[i]) for(auto c: nns) c->landparam = 0xFFFFFF;
history::progress(s);
}
inpath.push_back(l[i]); inpath.push_back(l[i]);
int sh = cpo * (isize(inpath)-1); int sh = cpo * (isize(inpath)-1);
@ -378,6 +400,7 @@ void wfc() {
println(hlog, "tfreq = ", format("%lld", tfreq)); println(hlog, "tfreq = ", format("%lld", tfreq));
println(hlog, "trans size = ", isize(trans)); println(hlog, "trans size = ", isize(trans));
println(hlog, "next code = ", nextcode); println(hlog, "next code = ", nextcode);
clearMessages();
wfc_build(); wfc_build();
} }