// wander7.c -- Generate raw output to describe results of rounder-router. // The idea is to generate a stream of ASCII '='s and '>'s to be gzipped and // stored. gzip -9 compresses this about 15 to 1. // ASCII '=' means, f(n) == f(n-1). '>' means f(n) == f(n-1)+1. #include #include main( ) { long A[ 256 ][ 256 ]; int nrows; long absorbed; int n, i, t; A[ 0 ][ 1 ] = 1; nrows = 1; absorbed = 0; putchar( '>' ); // f(1) > f(0). for( n = 2; n <= 1 << 20 && nrows < 254; n++ ) { i = 1; for( t = 0; t < nrows; t++ ) { A[ t ][ i ]++; if( A[ t ][ i ] % 3 == 2 ) { i--; if( i == 0 ) break; } else { i++; } } while( A[ nrows - 1 ][ 1 ] > 1 ) { for( t = nrows; t < nrows + 2; t++ ) { for( i = 1; i <= t; i++ ){ A[ t ][ i - 1 ] += ( A[ t - 1 ][ i ] * 2 + 3 ) / 6; A[ t ][ i + 1 ] += ( A[ t - 1 ][ i ] * 4 + 3 ) / 6; } } i = 0; // Signal that one has been absorbed. nrows += 2; } if( i == 0 ) { absorbed++; putchar( '=' ); } else { putchar( '>' ); } } }