#include #include #include #include #include #include #include using namespace std; typedef uint32_t State; const State logState = 16; const State maxState = 1 << logState; bitset<8> rule(110); State update(State s) { State r(0); bitset b(s); for (unsigned i=0; i Trans; void iterTrans(int times, function f) { while (times--) for (State s=0; s(s) << endl; } void printTraj(State s, int count) { while (count--) { cout << bitset(s) << endl; s = update(s); } } int main(int argc, char **argv) { assert(argc >= 2); rule = atoi(argv[1]); if (!strcmp(argv[2], "traj")) { assert(argc == 5); printTraj(atoi(argv[3]), atoi(argv[4])); } if (!strcmp(argv[2], "cycle")) { Trans &t = *(new Trans); init(t); Trans &c(*findCycle(t)); print(c); } return 0; }