#define W 10 #define H 10 // Recursive approach BigLittle24d.cc derived from BigLittle32c.cc // Saves a factor of T! by starting from the next ministate in sequence struct Box { unsigned int r[H] ; }; #define littleW 2 #define bigW 4 #define bigHoptions (H-bigW+1) #define bigWoptions (W-bigW+1) #define littleOptions ((W-littleW+1)*(H-littleW+1)) #define bigOptions ((W-bigW+1)*(H-bigW+1)) #define littleSection (1< using namespace std; Box little[littleOptions] ; Box big[bigOptions] ; void bitsout( unsigned int n ); void boxout( Box bj ) ; void addMore( int t, // number of further little guys to add Box bj, // current situation, passed by value int nextj, // which new little state to start from int &ok // number of successful final states so far ) ; int main(int argc, char* argv[]) { int T = 3 ; // target number of small particles if(argc>1) { sscanf( argv[1], "%d", &T ) ; // put the first command-line argument in T } cout << "bigOptions = " << bigOptions << endl; cout << "littleOptions = " << littleOptions << endl; cout << "littleSection = " << littleSection << endl; // make all states of a little guy for ( int i = 0 ; i < littleOptions ; i ++ ) { for ( int h=0; h < H ; h ++ ) { little[i].r[h]=0; } int ix = i % (W-littleW+1) ; int iy = i / (W-littleW+1) ; for ( int row = iy ; row < iy +littleW ; row ++ ) { little[i].r[row] = littleSection << ix ; } } // make all states of a big guy for ( int i = 0 ; i < bigOptions ; i ++ ) { for ( int h=0; h < H ; h ++ ) { big[i].r[h]=0; } int ix = i % (W-bigW+1) ; int iy = i / (W-bigW+1) ; for ( int row = iy ; row < iy +bigW ; row ++ ) { big[i].r[row] = bigSection << ix ; } } if(0){ for ( int j = 0 ; j < bigOptions/100 ; j ++ ) { cout << j << " th state of big dude" << endl; boxout(big[j]); } for ( int i = 0 ; i < littleOptions/100 ; i ++ ) { cout << i << " th state of little dude " << endl; boxout( little[i] ); } } // run through all big states, showing the number of states of // one little guy cout << "Single small-particle states" <= 0 ; i -- ) { two_to_power_i = (1<