#include #include #include #include #include #include typedef struct { int tag; int pid; int nch; int ctag[10]; int cpid[10]; } cinfo_t; void printtag ( int t, int d ) { int i; for (i=d-1; i>=0; --i) printf("%c", (t & (1 << i)) ? '1' : '0'); } cinfo_t createcube ( int d ) { int l, ctag, cpid, cno, shift; cinfo_t cinfo; cinfo.tag = 0; cinfo.nch = 0; for (l=0; l 1) ? atoi(argv[1]) : 4; if ((d < 0) || (d > 10)) d = 4; srand((unsigned int)time(NULL)); cinfo = createcube(d); printcinfo(cinfo,d); dowork(); waitcube(cinfo,d); exit(0); }