From 0fb6ddb3bce5f98bc309c3e5b18a60d6474228c8 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 24 Dec 2021 23:09:47 +0100 Subject: [PATCH] rulegen:: tests:: list coordination sequences --- devmods/rulegen-tests.cpp | 49 +++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/devmods/rulegen-tests.cpp b/devmods/rulegen-tests.cpp index c615a1a9..1ac7f554 100644 --- a/devmods/rulegen-tests.cpp +++ b/devmods/rulegen-tests.cpp @@ -429,7 +429,9 @@ void test_rules() { println(hlog, "sequence: ", seq); } -void list_sequence() { +fhstream *seq_stream; + +void list_all_sequences(string tesname) { int N = isize(treestates); if(!N) { @@ -437,23 +439,29 @@ void list_sequence() { return; } - vector howmany(N); - howmany[0] = 1; + for(int i=0; i howmany(N); - vector seq; - - for(int iter=0; iter<30; iter++) { - bignum total; - for(auto& h: howmany) total += h; - seq.push_back(total.get_str(100)); - vector next(N); - for(int id=0; id= 0) - next[s] += howmany[id]; - howmany = std::move(next); + howmany[i] = 1; + + vector seq; + + for(int iter=0; iter<60; iter++) { + bignum total; + for(auto& h: howmany) total += h; + seq.push_back(total.get_str(100)); + vector next(N); + for(int id=0; id= 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(); @@ -772,7 +780,9 @@ void test_current(string tesname) { /* for(auto& a: analyzers) println(hlog, "analyzer ", a.first, " size is ", isize(a.second.spread)); */ fflush(stdout); - list_sequence(); + + if(seq_stream) + list_all_sequences(tesname); fflush(stdout); } @@ -1134,6 +1144,11 @@ int testargs() { shift(); origin_id = argi(); } + else if(argis("-seqf")) { + shift(); + seq_stream = new fhstream(args(), "w"); + } + else if(argis("-tesgen")) { shift(); string s = args(); set_general(s);