1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-20 11:54:48 +00:00

rulegen:: tests:: list coordination sequences

This commit is contained in:
Zeno Rogue 2021-12-24 23:09:47 +01:00
parent 1343eacc1c
commit 0fb6ddb3bc

View File

@ -429,7 +429,9 @@ void test_rules() {
println(hlog, "sequence: ", seq); println(hlog, "sequence: ", seq);
} }
void list_sequence() { fhstream *seq_stream;
void list_all_sequences(string tesname) {
int N = isize(treestates); int N = isize(treestates);
if(!N) { if(!N) {
@ -437,23 +439,29 @@ void list_sequence() {
return; return;
} }
vector<bignum> howmany(N); for(int i=0; i<N; i++) if(treestates[i].is_root) {
howmany[0] = 1; vector<bignum> howmany(N);
vector<string> seq; howmany[i] = 1;
for(int iter=0; iter<30; iter++) { vector<string> seq;
bignum total;
for(auto& h: howmany) total += h; for(int iter=0; iter<60; iter++) {
seq.push_back(total.get_str(100)); bignum total;
vector<bignum> next(N); for(auto& h: howmany) total += h;
for(int id=0; id<N; id++) seq.push_back(total.get_str(100));
for(int s: treestates[id].rules) if(s >= 0) vector<bignum> next(N);
next[s] += howmany[id]; for(int id=0; id<N; id++)
howmany = std::move(next); for(int s: treestates[id].rules) if(s >= 0)
next[s] += howmany[id];
howmany = std::move(next);
}
println(*seq_stream, (hyperbolic ? "H " : "E "), "FILE ", tesname, ", id ");
println(*seq_stream, seq);
} }
println(hlog, "sequence: ", seq); fflush(seq_stream->f);
} }
void print_rules(); void print_rules();
@ -772,7 +780,9 @@ void test_current(string tesname) {
/* for(auto& a: analyzers) /* for(auto& a: analyzers)
println(hlog, "analyzer ", a.first, " size is ", isize(a.second.spread)); */ println(hlog, "analyzer ", a.first, " size is ", isize(a.second.spread)); */
fflush(stdout); fflush(stdout);
list_sequence();
if(seq_stream)
list_all_sequences(tesname);
fflush(stdout); fflush(stdout);
} }
@ -1134,6 +1144,11 @@ int testargs() {
shift(); origin_id = argi(); shift(); origin_id = argi();
} }
else if(argis("-seqf")) {
shift();
seq_stream = new fhstream(args(), "w");
}
else if(argis("-tesgen")) { else if(argis("-tesgen")) {
shift(); string s = args(); shift(); string s = args();
set_general(s); set_general(s);