Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!rq02+ From: rq02+@andrew.cmu.edu (Richard Quadrel) Newsgroups: comp.sys.mac.games Subject: 3 in 3: Brute Force Method (source) Message-ID: Date: 3 Mar 91 22:15:27 GMT Organization: Architecture, Carnegie Mellon, Pittsburgh, PA Lines: 267 #include #include /*-------------------------------------------------------------------* state of the 24 "security doors," which are numbered from 0 to 23 starting at the upper left corner and going across *-------------------------------------------------------------------*/ int state[24]; FILE* fp; void wig(); int *shiftx(); void display(); void test(); void alterstate(); void main() { /*-------------------------------------------------------------------* array x is the array with the values of the available "buttons" *-------------------------------------------------------------------*/ int x[12]; x[0]=7; x[1]=8; x[2]=9; x[3]=10; x[4]=13; x[5]=14; x[6]=15; x[7]=16; x[8]=19; x[9]=20; x[10]=21; x[11]=22; fp = fopen("solutions", "w"); fprintf(fp, "%d\n", time(0)); fflush(fp); wig(12,x); fclose(fp); } /*-------------------------------------------------------------------* wig is a recursive function that generates all possible orderings of a sequence of numbers. Why "wig?"... well when it worked, it flipped mine. *-------------------------------------------------------------------*/ void wig(int col, int *x) { int i; int *save; for (i=0; i