#include "comb/id-tree-lev-seq.h"
#include "comb/word-stats.h"
#include "fxtio.h"
#include "fxttypes.h"
#include "jjassert.h"
#include "nextarg.h"
//% Statistics for (level sequences of) unordered rooted identity trees.
//% Cf. the following OEIS sequences:
//% A004111: all identity trees.
//% A227819: identity trees by height.
//% A055327: identity trees by number of descents.
//% A227774: identity trees by number of ones.
//% A244523: identity trees by maximal branching number (out-degree).
// Cf. comb/ordered-tree-lev-seq-stats-demo.cc for stats for ordered trees
//#define TIMING // uncomment to disable printing
int
main(int argc, char **argv)
{
ulong n = 8;
NXARG(n, "Number of non-root nodes");
// jjassert( n>=1 );
ulong sq = 0;
NXARG(sq, "Select stats:\n"
" 0 ==> by height\n"
" 1 ==> number of ascents\n"
" 2 ==> number of descents\n"
" 3 ==> number of ones\n"
// " 4 ==> number of fixed points\n" // same stats as 0
" 5 ==> number of maximal levels\n"
" 6 ==> position of last occurrence of one\n"
// " 7 ==> position of first occurrence of the maximal value\n" // same stats as 0
" 8 ==> position of last occurrence of the maximal value\n"
// " 9 ==> number of flat steps\n"
" 10 ==> number of even values\n"
" 11 ==> number of odd values\n"
// " 20 ==> number of flat steps\n"
// " 21 ==> number of non-flat steps\n"
" 25 ==> number of peaks\n"
// " 11 ==> number of \n"
);
bool aa = false; // whether to print as ASCII art
NXARG(aa,"Whether to render trees as ASCII art");
id_tree_lev_seq T(n);
const ulong N = T.size(); // + (n==0);
// cout << " :: N = " << N << endl;
word_stats W(T.data(), N);
ulong ct = 0;
ulong * st = new ulong[N]; // stats
for (ulong k=0; k