diff --git a/Source/a.out b/Source/a.out new file mode 100644 index 0000000..2d32f8d Binary files /dev/null and b/Source/a.out differ diff --git a/Source/header/input.h b/Source/header/input.h index 5367cc3..f93c63c 100644 --- a/Source/header/input.h +++ b/Source/header/input.h @@ -1,16 +1,16 @@ -#include - -class Part -{ -public: - Part(): connections(0){} - ~Part() {} - uint8_t getConnections() const - {return connections;} - - void setConnections(uint8_t newconnections) - {connections = newconnections;} - -private: - uint8_t connections; +#include + +class Part +{ +public: + Part(): connections(0){} + ~Part() {} + uint8_t getConnections() const + {return connections;} + + void setConnections(uint8_t newconnections) + {connections = newconnections;} + +private: + uint8_t connections; }; \ No newline at end of file diff --git a/Source/main.cpp b/Source/main.cpp index 5b41fb2..878e264 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -1,19 +1,19 @@ -#include -#include -#include -#include -#include -#include - -#include "header/input.h" - -using namespace std; - -int main() -{ - vector myFirstPuzzle; - Part myFirstPart; - myFirstPart.setConnections(0b00101000); - myFirstPuzzle.push_back(myFirstPart); - cout << "Hello World" << endl; -} +#include +#include +#include +#include +#include +#include + +#include "header/input.h" + +using namespace std; + +int main() +{ + vector myFirstPuzzle; + Part myFirstPart; + myFirstPart.setConnections(0b00101000); + myFirstPuzzle.push_back(myFirstPart); + cout << "Hello World" << endl; +} diff --git a/TeamCMU/Basic_Structure.txt b/TeamCMU/Basic_Structure.txt new file mode 100644 index 0000000..fe185fc --- /dev/null +++ b/TeamCMU/Basic_Structure.txt @@ -0,0 +1,34 @@ +Übergangstruktur + +next() +{ + calculate best next move out of information in log + solve(with m and n or a puzzlepiece from box) +} + +solve() +{ + solve algorithm + + if(no solution) backtrack! + if(multiple solutions) set multiple solutions into log...setsolution(); + if(one solution) set solution into log...setsolution(); + + return{no solution, multiple solutions, one solution} + +} + +setsolution() +{ + set pointer(s) in log + set pointer to log into matrix +} + +backtrack() +{ + go into log, remove last piece + + goes back to next() +} + + diff --git a/TeamCMU/Revision_01/Puzzle.h b/TeamCMU/Revision_01/Puzzle.h new file mode 100644 index 0000000..854a95d --- /dev/null +++ b/TeamCMU/Revision_01/Puzzle.h @@ -0,0 +1,375 @@ +//Raphael Maenle - 11.11.2017 + +#include +#include +#include +#include +#include +#include + +using namespace std; + +class PuzzlePiece +{ +public: + + unsigned char Ringbuffer; + + PuzzlePiece(unsigned int flag = 0) + { + shifts=0; + boxidentifier=-1; + switch(flag) + { + case 0: + Ringbuffer=0b00000000; + break; + case 1: + Ringbuffer=0b11111111; + break; + case 3: + randomCenterPiece(); + break; + } + + } + + void Shift(unsigned int moves) + { + //Shift ringbuffer to the right n number of times + shifts = (shifts+moves)%4; + Ringbuffer = ((Ringbuffer >> (moves*2)) | (Ringbuffer << sizeof(unsigned char)*8 - (moves*2))); + } + + void printPiece() + { + cout << bitset (Ringbuffer); + } + //makes piece to random center piece + void randomCenterPiece() + { + this->Ringbuffer= 0b00000000; + + if(rand()%2) + this->Ringbuffer |= 0b01000000; + else + this->Ringbuffer |= 0b10000000; + + if(rand()%2) + this->Ringbuffer |= 0b00010000; + else + this->Ringbuffer |= 0b00100000; + + if(rand()%2) + this->Ringbuffer |= 0b00000100; + else + this->Ringbuffer |= 0b00001000; + + if(rand()%2) + this->Ringbuffer |= 0b00000001; + else + this->Ringbuffer |= 0b00000010; + } + + void assignIdentifier() + { + identifier = idcount; + idcount++; + } + + unsigned int getIdentifier() + { + return identifier; + } + void setBoxIdentifier(int new_boxid) + { + boxidentifier = new_boxid; + } + int getBoxIdentifier() + { + return boxidentifier; + } +private: + unsigned int shifts; + unsigned int identifier; + int boxidentifier; + static unsigned int idcount; + + +}; + +unsigned int PuzzlePiece::idcount(0); + +//saves a matrix cluster of puzzlepieces +class Puzzle +{ +public: + Puzzle(uint m = 7, uint n = 4): col(m), row(n) + { + Matrix = new PuzzlePiece* [n+2]; + //Box = new PuzzlePiece[n*m]; + for(int i = 0;iPlaceOfPartGood(m,n,newPiece)) + { + Matrix[n+1][m+1] = newPiece; + return 1; + } + return 0; + } + bool removePiece(uint m,uint n) + { + + Matrix[n+1][m+1] = 0b11111111; + return 1; + + } + + PuzzlePiece getPiece(uint m,uint n) + { + return Matrix[n+1][m+1]; + } + PuzzlePiece sudogetPiece(uint m,uint n) + { + return Matrix[n][m]; + } + + //check if place of the part in the matrix is correct + bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart); + bool testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart); + unsigned int tryAllPieces(unsigned int m, unsigned int n, vector& myBox, unsigned int separator); + unsigned int putBackIntoBox(unsigned int m, unsigned int n, vector& myBox); + + void printPuzzle(); + + uint getCols() + { + return col; + } + + uint getRows() + { + return row; + } + //creates a random puzzle of size m columns, n rows + void createRandomPuzzle(); + //shuffles Box; + vector Shuffle(); + //prints box + void printBox(); + +private: + uint row; + uint col; + + PuzzlePiece** Matrix; + vector Box; + + void sudosetPiece(uint m,uint n,PuzzlePiece newPiece) + { + if(this->PlaceOfPartGood(m,n,newPiece)) + Matrix[n][m] = newPiece; + } + void sudoprintPuzzle() + { + for(int i=0;i (topPart) << endl; + + unsigned char rightPart = ((negativePart.Ringbuffer & 0b00110000) ^ (tmpPuzzlePiece.Ringbuffer & 0b00110000)); + cout << "rightPart: " << bitset (rightPart) << endl; + + unsigned char lowPart = ((negativePart.Ringbuffer & 0b00001100) ^ (tmpPuzzlePiece.Ringbuffer & 0b00001100)); + cout << "lowPart: " << bitset (lowPart) << endl; + + unsigned char leftPart = ((negativePart.Ringbuffer & 0b00000011) ^ (tmpPuzzlePiece.Ringbuffer & 0b00000011)); + cout << "leftPart: " << bitset (leftPart) << endl; +*/ + + if ( //simplify + ( ((((negativePart.Ringbuffer & 0b11000000) ^ (tmpPuzzlePiece.Ringbuffer & 0b11000000)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b11000000) != 0b00000000) + || ((((negativePart.Ringbuffer & 0b11000000) == 0b11000000) || ((tmpPuzzlePiece.Ringbuffer & 0b11000000) == 0b11000000)) && (tmpPuzzlePiece.Ringbuffer & 0b11000000) != 0b00000000) + || (((negativePart.Ringbuffer & 0b11000000) == 0b00000000) && ((tmpPuzzlePiece.Ringbuffer & 0b11000000) == 0b00000000)) ) + && + ( ((((negativePart.Ringbuffer & 0b00110000) ^ (tmpPuzzlePiece.Ringbuffer & 0b00110000)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b001100) != 0b00000000) + || ((((negativePart.Ringbuffer & 0b00110000) == 0b00110000) || ((tmpPuzzlePiece.Ringbuffer & 0b00110000) == 0b00110000)) && (tmpPuzzlePiece.Ringbuffer & 0b00110000) != 0b00000000) + || (((negativePart.Ringbuffer & 0b00110000) == 0b00000000) && ((tmpPuzzlePiece.Ringbuffer & 0b00110000) == 0b00000000)) ) + && + ( ((((negativePart.Ringbuffer & 0b00001100) ^ (tmpPuzzlePiece.Ringbuffer & 0b00001100)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b00001100) != 0b00000000) + || ((((negativePart.Ringbuffer & 0b00001100) == 0b00001100) || ((tmpPuzzlePiece.Ringbuffer & 0b00001100) == 0b00001100)) && (tmpPuzzlePiece.Ringbuffer & 0b00001100) != 0b00000000) + || (((negativePart.Ringbuffer & 0b00001100) == 0b00000000) && ((tmpPuzzlePiece.Ringbuffer & 0b00001100) == 0b00000000)) ) + && + ( ((((negativePart.Ringbuffer & 0b00000011) ^ (tmpPuzzlePiece.Ringbuffer & 0b00000011)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b00000011) != 0b00000000) + || ((((negativePart.Ringbuffer & 0b00000011) == 0b00000011) || ((tmpPuzzlePiece.Ringbuffer & 0b00000011) == 0b00000011)) && (tmpPuzzlePiece.Ringbuffer & 0b00000011) != 0b00000000) + || (((negativePart.Ringbuffer & 0b00000011) == 0b00000000) && ((tmpPuzzlePiece.Ringbuffer & 0b00000011) == 0b00000000)) ) + ) + + return 1; + + + return 0; +} + +void Puzzle::printPuzzle() +{ + for(int i=1;i::iterator i = Box.begin(); i != Box.end(); i++) + { + (*i).printPiece(); + cout << ' '; + } + cout << endl; +} + +vector Puzzle::Shuffle() +{ + random_shuffle(Box.begin(),Box.end()); + return Box; +} + +bool Puzzle::testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart) +{ + for(int rotation=0; rotation < 4; rotation++) + { + myPart.Shift(1); + myPart.printPiece(); + cout << endl; + if(PlaceOfPartGood(m,n, myPart)) + { + + return 1; + } + } + return 0; +} + +//tries all pieces in box from separator to end and places fitting into matrix. removes fitting piece +//use separator if you have to retract to a position +unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector& myBox, unsigned int separator) +{ + + for(int i=separator; i& myBox) +{ + for(int i = 0; i < myBox.size();i++) + { + if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier()) + { + myBox.insert(myBox.begin()+i,getPiece(m,n)); + removePiece(m,n); + return i; + } + } +} + +vector createBox(uint m, uint n) +{ + Puzzle myFirstPuzzle(m,n); + myFirstPuzzle.createRandomPuzzle(); + return myFirstPuzzle.Shuffle(); +} diff --git a/TeamCMU/Revision_01/main.cpp b/TeamCMU/Revision_01/main.cpp new file mode 100644 index 0000000..9269d3a --- /dev/null +++ b/TeamCMU/Revision_01/main.cpp @@ -0,0 +1,160 @@ +//Raphael Maenle - 11.11.2017 +#include +#include +#include +#include +#include +#include + +#include "puzzle.h" +//#include "Solver.h" + +using namespace std; + +void numerateBox(vector& myBox); +Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector& myFirstBox); +void retractOuterFirst(int& i, int& j, int cols, int rows, int perimiter); + +int main() +{ + srand(time(0)); + + //Puzzle myFirstPuzzle(3,4); + + int rows = 2, cols = 3; + + vector myFirstBox = createBox(cols, rows); + numerateBox(myFirstBox); + cout << "now in solve: " << endl << endl; + solveOuterFirst(rows,cols,myFirstBox); +} + +//set box identifiers +void numerateBox(vector& myBox) +{ + for(int i = 0; i< myBox.size();i++) + myBox[i].setBoxIdentifier(i); + + return; +} + +//goes round and round puzzle and tries all pieces +Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector& myFirstBox) +{ + int i = 0, j= 0, Boxsize = rows*cols, separator=0; + Puzzle myFirstPuzzle(cols, rows); + //first Piece + cout << "#0 i: " << i << ", j: " << j << endl; + + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + cout << "error at first piece" << endl; + } + myFirstPuzzle.printPuzzle(); +/* + Boxsize--; + + //rotate through puzzle + for(int perimiter = 0; perimiter <= (cols>rows?rows:cols)/2;) + { + cout << "perimiter: " << perimiter << endl; + while(( i == 0+perimiter && j < cols-perimiter-1) && Boxsize) + { + j++; + Boxsize--; + cout << "#1 i: " << i << ", j: " << j << endl; + + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + Boxsize++; + break; + } + else + { + Boxsize--; + } + } + + while(( i < rows-perimiter-1 && j == cols-perimiter-1) && Boxsize) + { + i++; + Boxsize--; + cout << "#2 i: " << i << ", j: " << j << endl; + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + Boxsize++; + break; + } + else + { + Boxsize--; + } + } + + while(( i == rows-perimiter-1 && j > 0+perimiter) && Boxsize) + { + j--; + Boxsize--; + cout << "#3 i: " << i << ", j: " << j << endl; + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + Boxsize++; + break; + } + else + { + Boxsize--; + } + } + + while(( i > 0+perimiter+1 && j == 0+perimiter) && Boxsize) + { + i--; + cout << "#4 i: " << i << ", j: " << j << endl; + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + Boxsize++; + break; + } + else + { + Boxsize--; + perimiter++; + } + } + } + myFirstPuzzle.printPuzzle(); +*/ + return myFirstPuzzle; +} + +//move i and j to position before +void retractOuterFirst(int& i, int& j, int cols, int rows, int perimiter) +{ + + if(( i == 0+perimiter && j <= cols-perimiter-1)) + { + j--; + } + + else if(( i <= rows-perimiter-1 && j == cols-perimiter-1)) + { + i--; + } + + else if(( i == rows-perimiter-1 && j >= 0+perimiter)) + { + j++; + } + + else if(( i >= 0+perimiter+1 && j == 0+perimiter)) + { + i++; + } + +} + diff --git a/TeamCMU/Revision_02/a.out b/TeamCMU/Revision_02/a.out new file mode 100644 index 0000000..a6efa5e Binary files /dev/null and b/TeamCMU/Revision_02/a.out differ diff --git a/TeamCMU/Revision_02/main.cpp b/TeamCMU/Revision_02/main.cpp new file mode 100644 index 0000000..185b92f --- /dev/null +++ b/TeamCMU/Revision_02/main.cpp @@ -0,0 +1,305 @@ +//Raphael Maenle - 11.11.2017 +#include +#include +#include +#include +#include +#include + +#define debug + +#include "puzzle.h" + +#include "test_puzzle.h" + +using namespace std; + +Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector& myFirstBox); +void retractOuterFirst(int& i, int& j, int cols, int rows, int& perimiter); + +int main() +{ + srand(time(0)); + + vector part_array(NR_PARTS); + vector corners_array(NR_CORNERS); + vector edges_array(NR_EDGES); + vector inners_array(NR_INNERS); + + //randomBox myPuzzle(cols,rows); + //myPuzzle.createRandomPuzzle(); + + + unsigned int rows=5, cols=5; + + //vector myFirstBox = createBox(cols, rows); + + //create4040hardBox(myFirstBox); + /*myFirstBox[0].setConnections(0b01100010); + myFirstBox[1].setConnections(0b00010100); + myFirstBox[2].setConnections(0b00011010); + myFirstBox[3].setConnections(0b10000001); + myFirstBox[4].setConnections(0b00011000); + myFirstBox[5].setConnections(0b01100000);*/ + + Puzzle myFirstPuzzle(3,4); + PuzzlePiece myFirstPiece(1); + myFirstPiece.setConnections(0b00010100); + + if(myFirstPuzzle.PlaceOfPartGood(myFirstPiece)); + cout << "good" << endl; + + //printBox(myFirstBox); + cout << endl; + + //Puzzle newPuzzle = solveOuterFirst(cols, rows, myFirstBox); + return 0; +} + + +//rotates in snail form clockwise around board and tries placing puzzle pieces. +//if no piece fits in position it tries next piece of the piece before +Puzzle solveOuterFirst( unsigned int cols, unsigned int rows, vector& myFirstBox) +{ + int i = 0, j= 0, Boxsize = rows*cols, separator=0; + Puzzle myFirstPuzzle(cols, rows); + //first Piece + + + //rotate through puzzle + int perimiter; + int numberofsolutions=0; + int newPerimiter = 1; + for(perimiter = 0; /*perimiter <= (cols>rows?rows:cols)/2;*/;) + { + if(Boxsize) + { +#ifdef debug +cout << "perimiter: " << perimiter << endl; +#endif + } + else + { + break; + retractOuterFirst(i,j,cols,rows,perimiter); + Boxsize++; + separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); + numberofsolutions++; + } + + if((i==rows/2 && j==cols/2 )&& cols==rows) + { + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + Boxsize++; + separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); + } + else + { + break; + separator=0; + Boxsize--; + } + } + + + if((i==perimiter+1 && j==perimiter)) + { +#ifdef debug +cout << "#0 i: " << i << ", j: " << j << endl; +#endif + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + Boxsize++; + separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); +#ifdef debug +cout << "New Box: "; +printBox(myFirstBox); +cout << endl; +myFirstPuzzle.printPuzzle(); +cout << "Boxsize: " << Boxsize << endl; +cout << "separator: " << separator << endl; +#endif + } + else + { + perimiter=newPerimiter; + newPerimiter++; + j++; + separator=0; + Boxsize--; +#ifdef debug +cout << " Perimiter: " << perimiter << endl; +myFirstPuzzle.printPuzzle(); +#endif + } + + } + else + { + + + //cout << "general information i: " << i << ", j: " << j << endl; + while(( i == 0+perimiter && j < cols-perimiter-1) && Boxsize) + { +#ifdef debug +cout << "#1 i: " << i << ", j: " << j << endl; +#endif + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); + Boxsize++; +#ifdef debug +cout << "New Box: "; +printBox(myFirstBox); +cout << endl; +myFirstPuzzle.printPuzzle(); +cout << "Boxsize: " << Boxsize << endl; +cout << "separator: " << separator << endl; +#endif + break; + } + else + { + j++; + separator=0; + Boxsize--; +#ifdef debug +myFirstPuzzle.printPuzzle(); +#endif + } + } + while(( i < rows-perimiter-1 && j == cols-perimiter-1) && Boxsize) + { +#ifdef debug +cout << "#2 i: " << i << ", j: " << j << endl; +#endif + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + + separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); + Boxsize++; +#ifdef debug +cout << "New Box: "; +printBox(myFirstBox); +cout << endl; +myFirstPuzzle.printPuzzle(); + +cout << "Boxsize: " << Boxsize << endl; +cout << "separator: " << separator << endl; +#endif + break; + } + else + { + i++; + separator=0; + Boxsize--; +#ifdef debug +myFirstPuzzle.printPuzzle(); +#endif + } + } + + while(( i == rows-perimiter-1 && j > 0+perimiter) && Boxsize) + { + +#ifdef debug +cout << "#3 i: " << i << ", j: " << j << endl; +#endif + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); + Boxsize++; +#ifdef debug +cout << "New Box: "; +printBox(myFirstBox); +cout << endl; +myFirstPuzzle.printPuzzle(); +cout << "Boxsize: " << Boxsize << endl; +cout << "separator: " << separator << endl; +#endif + break; + } + else + { + j--; + separator=0; + Boxsize--; +#ifdef debug +myFirstPuzzle.printPuzzle(); +#endif + } + } + + while(( i > 0+perimiter+1 && j == 0+perimiter) && Boxsize) + { +#ifdef debug +cout << "#4 i: " << i << ", j: " << j << endl; +#endif + if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) + { + retractOuterFirst(i,j,cols,rows,perimiter); + separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); + Boxsize++; +#ifdef debug +cout << "New Box: "; +printBox(myFirstBox); +cout << endl; +myFirstPuzzle.printPuzzle(); + +cout << "Boxsize: " << Boxsize << endl; +cout << "separator: " << separator << endl; +#endif + break; + } + else + { + i--; + separator=0; + Boxsize--; +#ifdef debug +myFirstPuzzle.printPuzzle(); +#endif + } + } + } + } + myFirstPuzzle.printPuzzle(); + + return myFirstPuzzle; +} + +//move i and j to position before +void retractOuterFirst(int& i, int& j, int cols, int rows, int& perimiter) +{ +#ifdef debug + cout << "retracting: i=" << i << " j=" << j << endl; +#endif + if(( i == 0+perimiter && j <= cols-perimiter-1)) + { + j--; + } + else if(( i <= rows-perimiter-1 && j == cols-perimiter-1)) + { + i--; + } + + else if(( i == rows-perimiter-1 && j >= 0+perimiter)) + { + j++; + } + + else if(( i >= 0+perimiter+1 && j == 0+perimiter)) + { + i++; + } +#ifdef debug + cout << "to: i=" << i << " j=" << j << endl; +#endif +} \ No newline at end of file diff --git a/TeamCMU/Revision_02/puzzle.h b/TeamCMU/Revision_02/puzzle.h new file mode 100644 index 0000000..2b69445 --- /dev/null +++ b/TeamCMU/Revision_02/puzzle.h @@ -0,0 +1,469 @@ +#include + +#define NR_PARTS 1008 +#define NR_CORNERS 4 +#define NR_EDGES 120 +#define NR_INNERS 884 + +using namespace std; + +//part from group header file +class Part +{ +public: + Part(): connections(0){} + ~Part() {} + uint8_t getConnections() const + { + return connections; + } + void setConnections(uint8_t newconnections) + { + connections = newconnections; + } + +private: + uint8_t connections; +}; + +//puzzlepiece extens part with essential identifiers and functions +class PuzzlePiece: public Part +{ +public: + + PuzzlePiece(unsigned int flag = 0) + { + shifts=0; + boxidentifier=-1; + switch(flag) + { + case 0: + setConnections(0b00000000); + break; + case 1: + setConnections(0b11111111); + break; + case 3: + randomCenterPiece(); + break; + } + } + + void shift(unsigned int moves); + void randomCenterPiece(); + void printPiece() { cout << bitset (getConnections()); } + + void setBoxIdentifier(int new_boxid) { boxidentifier = new_boxid; } + int getBoxIdentifier() { return boxidentifier; } + void assignIdentifier() { identifier = idcount;idcount++; } + unsigned int getIdentifier() { return identifier;} + +private: + unsigned int shifts; + unsigned int boxidentifier; + unsigned int identifier; + static unsigned int idcount; +}; + +unsigned int PuzzlePiece::idcount(0); + +class Puzzle +{ + friend class randomBox; +public: + //constructor creates matrix with 00 outside and 11 inside + Puzzle(uint m = 7, uint n = 4): col(m), row(n) + { + Matrix = new PuzzlePiece* [n+2]; + for(int i = 0;i& myBox, unsigned int separator); + unsigned int putBackIntoBox(unsigned int m, unsigned int n, vector& myBox); + + +private: + uint row; + uint col; + + PuzzlePiece** Matrix; + +}; + +//use this for random puzzle creation +class randomBox: public Puzzle +{ +public: + + randomBox(unsigned int m, unsigned int n) : Puzzle(m,n) {} //passed m n to puzzle constructor + + void createRandomPuzzle(); + vector shuffle(); + void printBox(); + +private: + vector Box; + +}; + +//functiondefinitions +void printBox(vector myBox); +vector createBox(uint m, uint n); +void numerateBox(vector& myBox); + +//functions + +//shifts puzzle piece one to the right +void PuzzlePiece::shift(unsigned int moves) +{ + shifts = (shifts+moves)%4; + setConnections(((getConnections() >> (moves*2)) | (getConnections() << sizeof(unsigned char)*8 - (moves*2)))); +} + +//creates random centerpiece +void PuzzlePiece::randomCenterPiece() +{ + setConnections(0b00000000); + + if(rand()%2) + setConnections(getConnections() | 0b01000000); + else + setConnections(getConnections() | 0b10000000); + + if(rand()%2) + setConnections(getConnections() | 0b00010000); + else + setConnections(getConnections() | 0b00100000); + + if(rand()%2) + setConnections(getConnections() | 0b00000100); + else + setConnections(getConnections() | 0b00001000); + + if(rand()%2) + setConnections(getConnections() | 0b00000001); + else + setConnections(getConnections() | 0b00000010); +} + +//tries all pieces in box from separator to end and places fitting into matrix. removes fitting piece +//use separator if you have to retract to a position +//seperator may be bigger than box size, if all puzzle pieces have already been looked at. +// it immediately retracts again then (returns -1) +unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector& myBox, unsigned int separator) +{ + for(int i=separator; i& myBox) +{ +#ifdef debug +cout << "putting back" << endl; +cout << "Old Box: "; +printBox(myBox); +cout << endl; +#endif + for(int i = 0; i < myBox.size();i++) + { + if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier()) + { + myBox.insert(myBox.begin()+i,getPiece(m,n)); + removePiece(m,n); + return i+1; + } + } + //using push back, if the element was the last element in the vector chain + myBox.push_back(getPiece(m,n)); + removePiece(m,n); + return myBox.size(); +} + +//checks if the myPart in its current orientation is legal in position m, n +bool Puzzle::PlaceOfPartGood(unsigned int m,unsigned int n, PuzzlePiece& myPart) +{ + + PuzzlePiece negativePart(0); + + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m-1,n).getConnections() & 0b00110000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); + negativePart.shift(2); + + + + if ( + ( ((((negativePart.getConnections() & 0b11000000) ^ (myPart.getConnections() & 0b11000000)) != 0b00000000) && (((myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000)) + || ((((negativePart.getConnections() & 0b11000000) == 0b11000000) || ((myPart.getConnections() & 0b11000000) == 0b11000000)) && (( myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000) + || (((negativePart.getConnections() & 0b11000000) == 0b00000000) && ((myPart.getConnections() & 0b11000000) == 0b00000000)) ) + && + ( ((((negativePart.getConnections() & 0b00110000) ^ (myPart.getConnections() & 0b00110000)) != 0b00000000) && (((myPart.getConnections() & 0b00110000) != 0b00000000) && (negativePart.getConnections() & 0b00110000) != 0b00000000)) + || ((((negativePart.getConnections() & 0b00110000) == 0b00110000) || ((myPart.getConnections() & 0b00110000) == 0b00110000)) && (((myPart.getConnections() & 0b00110000) != 0b00000000) && (negativePart.getConnections() & 0b00110000) != 0b00000000)) + || (((negativePart.getConnections() & 0b00110000) == 0b00000000) && ((myPart.getConnections() & 0b00110000) == 0b00000000)) ) + && + ( ((((negativePart.getConnections() & 0b00001100) ^ (myPart.getConnections() & 0b00001100)) != 0b00000000) && (((myPart.getConnections() & 0b00001100) != 0b00000000) && (negativePart.getConnections() & 0b00001100) != 0b00000000)) + || ((((negativePart.getConnections() & 0b00001100) == 0b00001100) || ((myPart.getConnections() & 0b00001100) == 0b00001100)) && (((myPart.getConnections() & 0b00001100) != 0b00000000) && (negativePart.getConnections() & 0b00001100) != 0b00000000)) + || (((negativePart.getConnections() & 0b00001100) == 0b00000000) && ((myPart.getConnections() & 0b00001100) == 0b00000000)) ) + && + ( ((((negativePart.getConnections() & 0b00000011) ^ (myPart.getConnections() & 0b00000011)) != 0b00000000) && (((myPart.getConnections() & 0b00000011) != 0b00000000) && (negativePart.getConnections() & 0b00000011) != 0b00000000)) + || ((((negativePart.getConnections() & 0b00000011) == 0b00000011) || ((myPart.getConnections() & 0b00000011) == 0b00000011)) && (((myPart.getConnections() & 0b00000011) != 0b00000000) && (negativePart.getConnections() & 0b00000011) != 0b00000000)) + || (((negativePart.getConnections() & 0b00000011) == 0b00000000) && ((myPart.getConnections() & 0b00000011) == 0b00000000)) ) + ) + { +#ifdef debug +cout << "good Part: "; +myPart.printPiece(); +cout << endl; +#endif + return 1; + } + + + + return 0; +} + + +//TODO!! +//simpler algorithm to the first placeofpartgood +//not yet functional!!! +bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart) +{ + /* + + PuzzlePiece negativePart(0); + + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m-1,n).getConnections() & 0b00110000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); + negativePart.shift(2); + + //A and D or B and C or not A and not B and not C and not D + + if ( + ( ( (negativePart.getConnections() & 0b10000000) & (myPart.getConnections() & 0b01000000)) + || ( (negativePart.getConnections() & 0b01000000) & (myPart.getConnections() & 0b10000000)) + || ((!(negativePart.getConnections() & 0b10000000) & !(myPart.getConnections() & 0b10000000)) & (!(negativePart.getConnections() & 0b01000000) & !(myPart.getConnections() & 0b01000000))) + ) + && + ( ( (negativePart.getConnections() & 0b00100000) & (myPart.getConnections() & 0b00010000)) + || ( (negativePart.getConnections() & 0b00010000) & (myPart.getConnections() & 0b00100000)) + || ((!(negativePart.getConnections() & 0b00100000) & !(myPart.getConnections() & 0b00100000)) & (!(negativePart.getConnections() & 0b00010000) & !(myPart.getConnections() & 0b00010000))) + ) + && + ( ( (negativePart.getConnections() & 0b00001000) & (myPart.getConnections() & 0b00000100)) + || ( (negativePart.getConnections() & 0b00000100) & (myPart.getConnections() & 0b00001000)) + || ((!(negativePart.getConnections() & 0b00001000) & !(myPart.getConnections() & 0b00001000)) & (!(negativePart.getConnections() & 0b00000100) & !(myPart.getConnections() & 0b00000100))) + ) + && + ( ( (negativePart.getConnections() & 0b00000010) & (myPart.getConnections() & 0b00000001)) + || ( (negativePart.getConnections() & 0b00000001) & (myPart.getConnections() & 0b00000010)) + || ((!(negativePart.getConnections() & 0b00000010) & !(myPart.getConnections() & 0b00000010)) & (!(negativePart.getConnections() & 0b00000001) & !(myPart.getConnections() & 0b00000001))) + ) + ) + + return 1; + + cout << "nogood" << endl; + return 0; + */ + + PuzzlePiece tmpPuzzlePiece = myPart; + + //make tmp a negativ part + if((tmpPuzzlePiece.Ringbuffer & 0b11000000) != 192 || 0) + tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b11000000); + if((tmpPuzzlePiece.Ringbuffer & 0b00110000) != 48 || 0) + tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00110000); + if((tmpPuzzlePiece.Ringbuffer & 0b00001100) != 12 || 0) + tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00001100); + if((tmpPuzzlePiece.Ringbuffer & 0b00000011) != 3 || 0) + tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00000011); + + PuzzlePiece negativePart(0); + + negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m,n+1).Ringbuffer & 0b11000000); + negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m-1,n).Ringbuffer & 0b00110000); + negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m,n-1).Ringbuffer & 0b00001100); + negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m+1,n).Ringbuffer & 0b00000011); + + negativePart.Shift(2); + + //check tmp part with environment + if(((negativePart.Ringbuffer & 0b11000000) == (tmpPuzzlePiece & 0b11000000)) && ((negativePart.Ringbuffer & 0b00110000) == (tmpPuzzlePiece & 0b00110000)) + && ((negativePart.Ringbuffer & 0b00001100) == (tmpPuzzlePiece & 0b00001100)) && ((negativePart.Ringbuffer & 0b00000011) == (tmpPuzzlePiece & 0b00000011))) + return 1; + + return 0; +} + +//prints the true puzzle (without 0 edges) +void Puzzle::printPuzzle() +{ + cout << "current Puzzle: " << endl; + for(int i=1;i::iterator i = Box.begin(); i != Box.end(); i++) + { + (*i).printPiece(); + cout << ' '; + } + cout << endl; +} + +//shuffles around a box, randomizing pieces and orientation +vector randomBox::shuffle() +{ + random_shuffle(Box.begin(),Box.end()); + for (vector::iterator i = Box.begin(); i != Box.end(); i++) + (*i).shift(rand()%4); + numerateBox(Box); + return Box; +} + +//creates a random box size m, n, shuffles it, and then retuns it +vector createBox(uint m, uint n) +{ + randomBox myFirstPuzzleBox(m,n); + myFirstPuzzleBox.createRandomPuzzle(); + return myFirstPuzzleBox.shuffle(); +} + +//prints contents of box +void printBox(vector myBox) +{ + cout << "current Box: " << endl; + for (vector::iterator i = myBox.begin(); i != myBox.end(); i++) + { + (*i).printPiece(); + cout << ' '; + } + cout << endl; + return; +} + +//gives every element in box a box identifier. +void numerateBox(vector& myBox) +{ + for(int i = 0; i< myBox.size();i++) + myBox[i].setBoxIdentifier(i); + + return; +} \ No newline at end of file diff --git a/TeamCMU/Revision_02/test_puzzle.h b/TeamCMU/Revision_02/test_puzzle.h new file mode 100644 index 0000000..f893bf0 --- /dev/null +++ b/TeamCMU/Revision_02/test_puzzle.h @@ -0,0 +1,406 @@ + + void create4040hardBox(vector& myFirstBox) +{ +myFirstBox[0].setConnections(0b01101001); +myFirstBox[1].setConnections(0b10011001); +myFirstBox[2].setConnections(0b01100110); +myFirstBox[3].setConnections(0b01101001); +myFirstBox[4].setConnections(0b10100101); +myFirstBox[5].setConnections(0b10010010); +myFirstBox[6].setConnections(0b01101001); +myFirstBox[7].setConnections(0b00101010); +myFirstBox[8].setConnections(0b01000110); +myFirstBox[9].setConnections(0b01011010); +myFirstBox[10].setConnections(0b01011010); +myFirstBox[11].setConnections(0b10010101); +myFirstBox[12].setConnections(0b01010101); +myFirstBox[13].setConnections(0b10101001); +myFirstBox[14].setConnections(0b10010101); +myFirstBox[15].setConnections(0b10101010); +myFirstBox[16].setConnections(0b01101010); +myFirstBox[17].setConnections(0b01101010); +myFirstBox[18].setConnections(0b00100101); +myFirstBox[19].setConnections(0b01100101); +myFirstBox[20].setConnections(0b10010001); +myFirstBox[21].setConnections(0b10010101); +myFirstBox[22].setConnections(0b10101001); +myFirstBox[23].setConnections(0b01010110); +myFirstBox[24].setConnections(0b10101010); +myFirstBox[25].setConnections(0b01101000); +myFirstBox[26].setConnections(0b01101010); +myFirstBox[27].setConnections(0b10010101); +myFirstBox[28].setConnections(0b10011010); +myFirstBox[29].setConnections(0b10011001); +myFirstBox[30].setConnections(0b01101010); +myFirstBox[31].setConnections(0b01100001); +myFirstBox[32].setConnections(0b01101010); +myFirstBox[33].setConnections(0b01100101); +myFirstBox[34].setConnections(0b01010101); +myFirstBox[35].setConnections(0b01010110); +myFirstBox[36].setConnections(0b01101010); +myFirstBox[37].setConnections(0b01010110); +myFirstBox[38].setConnections(0b01100110); +myFirstBox[39].setConnections(0b01011010); +myFirstBox[40].setConnections(0b01100101); +myFirstBox[41].setConnections(0b01101001); +myFirstBox[42].setConnections(0b01010110); +myFirstBox[43].setConnections(0b01000110); +myFirstBox[44].setConnections(0b01011001); +myFirstBox[45].setConnections(0b01101001); +myFirstBox[46].setConnections(0b10000101); +myFirstBox[47].setConnections(0b10011010); +myFirstBox[48].setConnections(0b10010110); +myFirstBox[49].setConnections(0b01011010); +myFirstBox[50].setConnections(0b10011001); +myFirstBox[51].setConnections(0b01001001); +myFirstBox[52].setConnections(0b10100110); +myFirstBox[53].setConnections(0b01001010); +myFirstBox[54].setConnections(0b10010010); +myFirstBox[55].setConnections(0b01001010); +myFirstBox[56].setConnections(0b01101001); +myFirstBox[57].setConnections(0b10100110); +myFirstBox[58].setConnections(0b10010110); +myFirstBox[59].setConnections(0b10010110); +myFirstBox[60].setConnections(0b10101001); +myFirstBox[61].setConnections(0b00100101); +myFirstBox[62].setConnections(0b00101001); +myFirstBox[63].setConnections(0b01101001); +myFirstBox[64].setConnections(0b01101001); +myFirstBox[65].setConnections(0b00100101); +myFirstBox[66].setConnections(0b10010110); +myFirstBox[67].setConnections(0b10011010); +myFirstBox[68].setConnections(0b01100110); +myFirstBox[69].setConnections(0b10010110); +myFirstBox[70].setConnections(0b01010100); +myFirstBox[71].setConnections(0b01011010); +myFirstBox[72].setConnections(0b01100110); +myFirstBox[73].setConnections(0b01100101); +myFirstBox[74].setConnections(0b10011010); +myFirstBox[75].setConnections(0b10010101); +myFirstBox[76].setConnections(0b10011010); +myFirstBox[77].setConnections(0b01100101); +myFirstBox[78].setConnections(0b10011010); +myFirstBox[79].setConnections(0b01010110); +myFirstBox[80].setConnections(0b01101010); +myFirstBox[81].setConnections(0b01010101); +myFirstBox[82].setConnections(0b01100101); +myFirstBox[83].setConnections(0b10100101); +myFirstBox[84].setConnections(0b01010110); +myFirstBox[85].setConnections(0b01101010); +myFirstBox[86].setConnections(0b10011010); +myFirstBox[87].setConnections(0b10010110); +myFirstBox[88].setConnections(0b01101010); +myFirstBox[89].setConnections(0b01011010); +myFirstBox[90].setConnections(0b01010110); +myFirstBox[91].setConnections(0b01100101); +myFirstBox[92].setConnections(0b00100101); +myFirstBox[93].setConnections(0b10100101); +myFirstBox[94].setConnections(0b10010110); +myFirstBox[95].setConnections(0b01100110); +myFirstBox[96].setConnections(0b10000110); +myFirstBox[97].setConnections(0b01001001); +myFirstBox[98].setConnections(0b10010110); +myFirstBox[99].setConnections(0b10100110); +myFirstBox[100].setConnections(0b10100110); +myFirstBox[101].setConnections(0b01100010); +myFirstBox[102].setConnections(0b01101010); +myFirstBox[103].setConnections(0b10011001); +myFirstBox[104].setConnections(0b01010101); +myFirstBox[105].setConnections(0b10011010); +myFirstBox[106].setConnections(0b10101001); +myFirstBox[107].setConnections(0b01100110); +myFirstBox[108].setConnections(0b10101001); +myFirstBox[109].setConnections(0b10101001); +myFirstBox[110].setConnections(0b10010100); +myFirstBox[111].setConnections(0b01100110); +myFirstBox[112].setConnections(0b01010110); +myFirstBox[113].setConnections(0b10010101); +myFirstBox[114].setConnections(0b01011001); +myFirstBox[115].setConnections(0b01101010); +myFirstBox[116].setConnections(0b10100110); +myFirstBox[117].setConnections(0b10100101); +myFirstBox[118].setConnections(0b10101010); +myFirstBox[119].setConnections(0b01011010); +myFirstBox[120].setConnections(0b10011000); +myFirstBox[121].setConnections(0b10010101); +myFirstBox[122].setConnections(0b10100101); +myFirstBox[123].setConnections(0b10000110); +myFirstBox[124].setConnections(0b01100101); +myFirstBox[125].setConnections(0b10100110); +myFirstBox[126].setConnections(0b10101010); +myFirstBox[127].setConnections(0b01101001); +myFirstBox[128].setConnections(0b01010101); +myFirstBox[129].setConnections(0b01100101); +myFirstBox[130].setConnections(0b10001001); +myFirstBox[131].setConnections(0b01101010); +myFirstBox[132].setConnections(0b01101010); +myFirstBox[133].setConnections(0b01100010); +myFirstBox[134].setConnections(0b01100110); +myFirstBox[135].setConnections(0b10100001); +myFirstBox[136].setConnections(0b10011001); +myFirstBox[137].setConnections(0b01101010); +myFirstBox[138].setConnections(0b01011001); +myFirstBox[139].setConnections(0b10001001); +myFirstBox[140].setConnections(0b01010101); +myFirstBox[141].setConnections(0b10100101); +myFirstBox[142].setConnections(0b01100101); +myFirstBox[143].setConnections(0b10100101); +myFirstBox[144].setConnections(0b10011010); +myFirstBox[145].setConnections(0b10010001); +myFirstBox[146].setConnections(0b10100110); +myFirstBox[147].setConnections(0b01101010); +myFirstBox[148].setConnections(0b10010101); +myFirstBox[149].setConnections(0b01100101); +myFirstBox[150].setConnections(0b10100101); +myFirstBox[151].setConnections(0b10100110); +myFirstBox[152].setConnections(0b10010001); +myFirstBox[153].setConnections(0b10101000); +myFirstBox[154].setConnections(0b10011010); +myFirstBox[155].setConnections(0b10100110); +myFirstBox[156].setConnections(0b01100110); +myFirstBox[157].setConnections(0b10100110); +myFirstBox[158].setConnections(0b01011010); +myFirstBox[159].setConnections(0b10100001); +myFirstBox[160].setConnections(0b01010101); +myFirstBox[161].setConnections(0b10011010); +myFirstBox[162].setConnections(0b10101001); +myFirstBox[163].setConnections(0b01010110); +myFirstBox[164].setConnections(0b01100001); +myFirstBox[165].setConnections(0b01011001); +myFirstBox[166].setConnections(0b01101001); +myFirstBox[167].setConnections(0b10011001); +myFirstBox[168].setConnections(0b10010101); +myFirstBox[169].setConnections(0b01100010); +myFirstBox[170].setConnections(0b01010110); +myFirstBox[171].setConnections(0b00010101); +myFirstBox[172].setConnections(0b10100101); +myFirstBox[173].setConnections(0b10101010); +myFirstBox[174].setConnections(0b10011010); +myFirstBox[175].setConnections(0b01100101); +myFirstBox[176].setConnections(0b10100110); +myFirstBox[177].setConnections(0b10101001); +myFirstBox[178].setConnections(0b01011010); +myFirstBox[179].setConnections(0b01101001); +myFirstBox[180].setConnections(0b10010101); +myFirstBox[181].setConnections(0b01101010); +myFirstBox[182].setConnections(0b10010110); +myFirstBox[183].setConnections(0b10010110); +myFirstBox[184].setConnections(0b10011001); +myFirstBox[185].setConnections(0b10100101); +myFirstBox[186].setConnections(0b10010110); +myFirstBox[187].setConnections(0b10010110); +myFirstBox[188].setConnections(0b10011010); +myFirstBox[189].setConnections(0b10010101); +myFirstBox[190].setConnections(0b01010001); +myFirstBox[191].setConnections(0b01010100); +myFirstBox[192].setConnections(0b10101000); +myFirstBox[193].setConnections(0b10100110); +myFirstBox[194].setConnections(0b01010001); +myFirstBox[195].setConnections(0b01010101); +myFirstBox[196].setConnections(0b01100110); +myFirstBox[197].setConnections(0b10100101); +myFirstBox[198].setConnections(0b00100101); +myFirstBox[199].setConnections(0b00100101); +myFirstBox[200].setConnections(0b10101001); +myFirstBox[201].setConnections(0b10101001); +myFirstBox[202].setConnections(0b01011001); +myFirstBox[203].setConnections(0b00001010); +myFirstBox[204].setConnections(0b01010101); +myFirstBox[205].setConnections(0b10011010); +myFirstBox[206].setConnections(0b10100110); +myFirstBox[207].setConnections(0b10100101); +myFirstBox[208].setConnections(0b10011001); +myFirstBox[209].setConnections(0b10100110); +myFirstBox[210].setConnections(0b10101010); +myFirstBox[211].setConnections(0b01010110); +myFirstBox[212].setConnections(0b01010101); +myFirstBox[213].setConnections(0b01100010); +myFirstBox[214].setConnections(0b10010110); +myFirstBox[215].setConnections(0b10011010); +myFirstBox[216].setConnections(0b01100100); +myFirstBox[217].setConnections(0b01010101); +myFirstBox[218].setConnections(0b10011010); +myFirstBox[219].setConnections(0b01100101); +myFirstBox[220].setConnections(0b10101001); +myFirstBox[221].setConnections(0b10010101); +myFirstBox[222].setConnections(0b10100101); +myFirstBox[223].setConnections(0b10101001); +myFirstBox[224].setConnections(0b10100110); +myFirstBox[225].setConnections(0b10011001); +myFirstBox[226].setConnections(0b01011010); +myFirstBox[227].setConnections(0b01000101); +myFirstBox[228].setConnections(0b01100110); +myFirstBox[229].setConnections(0b10101010); +myFirstBox[230].setConnections(0b01010100); +myFirstBox[231].setConnections(0b10101010); +myFirstBox[232].setConnections(0b10011010); +myFirstBox[233].setConnections(0b10100110); +myFirstBox[234].setConnections(0b10011000); +myFirstBox[235].setConnections(0b10011001); +myFirstBox[236].setConnections(0b01010101); +myFirstBox[237].setConnections(0b01001010); +myFirstBox[238].setConnections(0b01100001); +myFirstBox[239].setConnections(0b10011010); +myFirstBox[240].setConnections(0b10010101); +myFirstBox[241].setConnections(0b10100110); +myFirstBox[242].setConnections(0b01010101); +myFirstBox[243].setConnections(0b10010101); +myFirstBox[244].setConnections(0b01101010); +myFirstBox[245].setConnections(0b01101010); +myFirstBox[246].setConnections(0b10100100); +myFirstBox[247].setConnections(0b00101010); +myFirstBox[248].setConnections(0b01100110); +myFirstBox[249].setConnections(0b01101000); +myFirstBox[250].setConnections(0b01101001); +myFirstBox[251].setConnections(0b10101001); +myFirstBox[252].setConnections(0b01010110); +myFirstBox[253].setConnections(0b10010110); +myFirstBox[254].setConnections(0b01100101); +myFirstBox[255].setConnections(0b01011001); +myFirstBox[256].setConnections(0b01100110); +myFirstBox[257].setConnections(0b00100101); +myFirstBox[258].setConnections(0b01101001); +myFirstBox[259].setConnections(0b10010110); +myFirstBox[260].setConnections(0b10011001); +myFirstBox[261].setConnections(0b10011001); +myFirstBox[262].setConnections(0b01101001); +myFirstBox[263].setConnections(0b01010010); +myFirstBox[264].setConnections(0b10101010); +myFirstBox[265].setConnections(0b01101001); +myFirstBox[266].setConnections(0b01101001); +myFirstBox[267].setConnections(0b01101001); +myFirstBox[268].setConnections(0b10010110); +myFirstBox[269].setConnections(0b10011001); +myFirstBox[270].setConnections(0b01101010); +myFirstBox[271].setConnections(0b10000110); +myFirstBox[272].setConnections(0b10010101); +myFirstBox[273].setConnections(0b00010101); +myFirstBox[274].setConnections(0b10101010); +myFirstBox[275].setConnections(0b01010110); +myFirstBox[276].setConnections(0b01100100); +myFirstBox[277].setConnections(0b01010101); +myFirstBox[278].setConnections(0b10010101); +myFirstBox[279].setConnections(0b01010101); +myFirstBox[280].setConnections(0b01011010); +myFirstBox[281].setConnections(0b10011010); +myFirstBox[282].setConnections(0b00010101); +myFirstBox[283].setConnections(0b10010110); +myFirstBox[284].setConnections(0b10100101); +myFirstBox[285].setConnections(0b10010101); +myFirstBox[286].setConnections(0b01101001); +myFirstBox[287].setConnections(0b10100101); +myFirstBox[288].setConnections(0b01101001); +myFirstBox[289].setConnections(0b10011001); +myFirstBox[290].setConnections(0b01011001); +myFirstBox[291].setConnections(0b10010110); +myFirstBox[292].setConnections(0b01010101); +myFirstBox[293].setConnections(0b10100110); +myFirstBox[294].setConnections(0b10101001); +myFirstBox[295].setConnections(0b10101001); +myFirstBox[296].setConnections(0b01011010); +myFirstBox[297].setConnections(0b10100101); +myFirstBox[298].setConnections(0b01011010); +myFirstBox[299].setConnections(0b01100110); +myFirstBox[300].setConnections(0b10010101); +myFirstBox[301].setConnections(0b10101001); +myFirstBox[302].setConnections(0b10011001); +myFirstBox[303].setConnections(0b01010101); +myFirstBox[304].setConnections(0b01010101); +myFirstBox[305].setConnections(0b10101001); +myFirstBox[306].setConnections(0b01100101); +myFirstBox[307].setConnections(0b01101000); +myFirstBox[308].setConnections(0b01010101); +myFirstBox[309].setConnections(0b10010110); +myFirstBox[310].setConnections(0b10010110); +myFirstBox[311].setConnections(0b01011010); +myFirstBox[312].setConnections(0b10010110); +myFirstBox[313].setConnections(0b01011001); +myFirstBox[314].setConnections(0b01010110); +myFirstBox[315].setConnections(0b01101001); +myFirstBox[316].setConnections(0b10100101); +myFirstBox[317].setConnections(0b10101010); +myFirstBox[318].setConnections(0b10011001); +myFirstBox[319].setConnections(0b01010110); +myFirstBox[320].setConnections(0b10100000); +myFirstBox[321].setConnections(0b10100101); +myFirstBox[322].setConnections(0b00010101); +myFirstBox[323].setConnections(0b01010110); +myFirstBox[324].setConnections(0b01101010); +myFirstBox[325].setConnections(0b10010110); +myFirstBox[326].setConnections(0b00001001); +myFirstBox[327].setConnections(0b10011010); +myFirstBox[328].setConnections(0b10101010); +myFirstBox[329].setConnections(0b01100101); +myFirstBox[330].setConnections(0b01011010); +myFirstBox[331].setConnections(0b01101010); +myFirstBox[332].setConnections(0b10100101); +myFirstBox[333].setConnections(0b10100101); +myFirstBox[334].setConnections(0b01011000); +myFirstBox[335].setConnections(0b01010110); +myFirstBox[336].setConnections(0b00100110); +myFirstBox[337].setConnections(0b01101010); +myFirstBox[338].setConnections(0b01101010); +myFirstBox[339].setConnections(0b10010110); +myFirstBox[340].setConnections(0b10101010); +myFirstBox[341].setConnections(0b01100110); +myFirstBox[342].setConnections(0b10011000); +myFirstBox[343].setConnections(0b10101010); +myFirstBox[344].setConnections(0b01011001); +myFirstBox[345].setConnections(0b01101001); +myFirstBox[346].setConnections(0b10010101); +myFirstBox[347].setConnections(0b10101010); +myFirstBox[348].setConnections(0b10011001); +myFirstBox[349].setConnections(0b01101001); +myFirstBox[350].setConnections(0b01010110); +myFirstBox[351].setConnections(0b10000110); +myFirstBox[352].setConnections(0b10010110); +myFirstBox[353].setConnections(0b10011010); +myFirstBox[354].setConnections(0b01010110); +myFirstBox[355].setConnections(0b10010010); +myFirstBox[356].setConnections(0b10100110); +myFirstBox[357].setConnections(0b10101001); +myFirstBox[358].setConnections(0b01011001); +myFirstBox[359].setConnections(0b01010000); +myFirstBox[360].setConnections(0b10011001); +myFirstBox[361].setConnections(0b01101001); +myFirstBox[362].setConnections(0b01100001); +myFirstBox[363].setConnections(0b10100110); +myFirstBox[364].setConnections(0b10100101); +myFirstBox[365].setConnections(0b01100101); +myFirstBox[366].setConnections(0b01001010); +myFirstBox[367].setConnections(0b10010110); +myFirstBox[368].setConnections(0b10010101); +myFirstBox[369].setConnections(0b10010100); +myFirstBox[370].setConnections(0b01010101); +myFirstBox[371].setConnections(0b01011000); +myFirstBox[372].setConnections(0b01100010); +myFirstBox[373].setConnections(0b10011001); +myFirstBox[374].setConnections(0b01100110); +myFirstBox[375].setConnections(0b10100101); +myFirstBox[376].setConnections(0b01000110); +myFirstBox[377].setConnections(0b01010101); +myFirstBox[378].setConnections(0b01100110); +myFirstBox[379].setConnections(0b10100110); +myFirstBox[380].setConnections(0b00100110); +myFirstBox[381].setConnections(0b01101001); +myFirstBox[382].setConnections(0b01100101); +myFirstBox[383].setConnections(0b10010101); +myFirstBox[384].setConnections(0b01101001); +myFirstBox[385].setConnections(0b10010110); +myFirstBox[386].setConnections(0b10010101); +myFirstBox[387].setConnections(0b10101001); +myFirstBox[388].setConnections(0b10011001); +myFirstBox[389].setConnections(0b01010110); +myFirstBox[390].setConnections(0b10100010); +myFirstBox[391].setConnections(0b10101001); +myFirstBox[392].setConnections(0b01101010); +myFirstBox[393].setConnections(0b10101010); +myFirstBox[394].setConnections(0b01100110); +myFirstBox[395].setConnections(0b01010101); +myFirstBox[396].setConnections(0b01101001); +myFirstBox[397].setConnections(0b10010101); +myFirstBox[398].setConnections(0b10100110); +myFirstBox[399].setConnections(0b01101010); +return; + +} \ No newline at end of file diff --git a/TeamCMU/Revision_03/a.out b/TeamCMU/Revision_03/a.out new file mode 100644 index 0000000..cd327e8 Binary files /dev/null and b/TeamCMU/Revision_03/a.out differ diff --git a/TeamCMU/Revision_03/main.cpp b/TeamCMU/Revision_03/main.cpp new file mode 100644 index 0000000..3701526 --- /dev/null +++ b/TeamCMU/Revision_03/main.cpp @@ -0,0 +1,115 @@ +//Raphael Maenle - 11.11.2017 +#include +#include +#include +#include +#include +#include + +#define debug + +#include "puzzle.h" +#include "test_puzzle.h" + +using namespace std; + +vector log; + +int main() +{ + srand(time(0)); + + vector part_array(NR_PARTS); + vector corners_array(NR_CORNERS); + vector edges_array(NR_EDGES); + vector inners_array(NR_INNERS); + + //randomBox myPuzzle(cols,rows); + //myPuzzle.createRandomPuzzle(); + + unsigned int rows=20, cols=20; + vector myFirstBox = createBox(cols, rows); + create4040hardBox(myFirstBox); + + printBox(myFirstBox); + cout << endl; + + + + + + + + + + + while(next()); + + + + + return 0; +} + +next() +{ + + //calculates next move according to log + + //case puzzle solved + //return 0; + + //case last log empty + //backtrack + + //case last log exactly one solution + //put all remaining puzzle pieces into new log entry + //try next piece/place with solve abstraction level 0 + + //case last log multiple entries + //advance abstraction layer of last log by one and solve() + //or pick first if highest level reached + + //return 1; +} + +solve() +{ + //case + //abstraction layer = 0 + //go to abstraction layer 0 solver + + //case + //abstraction layer = 1 + //go to abstraction layer 1 solver + //default + //random one of the parts +} + +abstractionlayer0solver() +{ + //throw all remaining puzzle pieces into log + //remove all impossible +} + +abstractionlayer1solver() +{ + //remove all impossible according to abstraction layer one +} + +setsolution() +{ + //put + //set pointer to log into matrix +} + +backtrack() +{ + //following possibilities: + //last log entry empty + //delete last log + backtrack + //last log entry only one solution + //delete last log + backtrack + //last log entry multiple solutions (and current one was randomed) + //delete randomed piece from puzzleCollector and go to next (which might random again depending on function) +} \ No newline at end of file diff --git a/TeamCMU/Revision_03/puzzle.h b/TeamCMU/Revision_03/puzzle.h new file mode 100644 index 0000000..2d61058 --- /dev/null +++ b/TeamCMU/Revision_03/puzzle.h @@ -0,0 +1,467 @@ +#include + +#define NR_PARTS 1008 +#define NR_CORNERS 4 +#define NR_EDGES 120 +#define NR_INNERS 884 + +using namespace std; + +//part from group header file +class Part +{ +public: + Part(): connections(0){} + ~Part() {} + uint8_t getConnections() const + { + return connections; + } + void setConnections(uint8_t newconnections) + { + connections = newconnections; + } + +private: + uint8_t connections; +}; + +//puzzlepiece extens part with essential identifiers and functions +class PuzzlePiece: public Part +{ +public: + + PuzzlePiece(unsigned int flag = 0) + { + shifts=0; + boxidentifier=-1; + switch(flag) + { + case 0: + setConnections(0b00000000); + break; + case 1: + setConnections(0b11111111); + break; + case 3: + randomCenterPiece(); + break; + } + } + + void shift(unsigned int moves); + void randomCenterPiece(); + void printPiece() { cout << bitset (getConnections()); } + + void setBoxIdentifier(int new_boxid) { boxidentifier = new_boxid; } + int getBoxIdentifier() { return boxidentifier; } + void assignIdentifier() { identifier = idcount;idcount++; } + unsigned int getIdentifier() { return identifier;} + +private: + unsigned int shifts; + unsigned int boxidentifier; + unsigned int identifier; + static unsigned int idcount; +}; + +unsigned int PuzzlePiece::idcount(0); + +class Puzzle +{ + friend class randomBox; +public: + //constructor creates matrix with 00 outside and 11 inside + Puzzle(uint m = 7, uint n = 4): col(m), row(n) + { + Matrix = new PuzzlePiece* [n+2]; + for(int i = 0;i& myBox, unsigned int separator); + unsigned int putBackIntoBox(unsigned int m, unsigned int n, vector& myBox); + + +private: + uint row; + uint col; + + PuzzlePiece** Matrix; + +}; + +//use this for random puzzle creation +class randomBox: public Puzzle +{ +public: + + randomBox(unsigned int m, unsigned int n) : Puzzle(m,n) {} //passed m n to puzzle constructor + + void createRandomPuzzle(); + vector shuffle(); + void printBox(); + +private: + vector Box; + +}; + +class coor +{ + int m, n; + coor(int newm,int newn): m(newm), n(newn) + {} +} + +class LogEntry +{ +public: + vector PieceCollector; + vector CoorCollector; + int abstractionLevel; + + uint myCoor; + PuzzlePiece* myPuzzlePiece; + + PuzzleCollector() + { + + myCoor.m=-1; + myCoor.n=-1; + abstractionLevel=0; + } +private: +} + + +//functiondefinitions +void printBox(vector myBox); +vector createBox(uint m, uint n); +void numerateBox(vector& myBox); + +//functions + +//shifts puzzle piece one to the right +void PuzzlePiece::shift(unsigned int moves) +{ + shifts = (shifts+moves)%4; + setConnections(((getConnections() >> (moves*2)) | (getConnections() << sizeof(unsigned char)*8 - (moves*2)))); +} + +//creates random centerpiece +void PuzzlePiece::randomCenterPiece() +{ + setConnections(0b00000000); + + if(rand()%2) + setConnections(getConnections() | 0b01000000); + else + setConnections(getConnections() | 0b10000000); + + if(rand()%2) + setConnections(getConnections() | 0b00010000); + else + setConnections(getConnections() | 0b00100000); + + if(rand()%2) + setConnections(getConnections() | 0b00000100); + else + setConnections(getConnections() | 0b00001000); + + if(rand()%2) + setConnections(getConnections() | 0b00000001); + else + setConnections(getConnections() | 0b00000010); +} + +//tries all pieces in box from separator to end and places fitting into matrix. removes fitting piece +//use separator if you have to retract to a position +//seperator may be bigger than box size, if all puzzle pieces have already been looked at. +// it immediately retracts again then (returns -1) +unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector& myBox, unsigned int separator) +{ + for(int i=separator; i& myBox) +{ +#ifdef debug +cout << "putting back" << endl; +cout << "Old Box: "; +printBox(myBox); +cout << endl; +#endif + for(int i = 0; i < myBox.size();i++) + { + if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier()) + { + myBox.insert(myBox.begin()+i,getPiece(m,n)); + removePiece(m,n); + return i+1; + } + } + //using push back, if the element was the last element in the vector chain + myBox.push_back(getPiece(m,n)); + removePiece(m,n); + return myBox.size(); +} + +//checks if the myPart in its current orientation is legal in position m, n +bool Puzzle::PlaceOfPartGood(unsigned int m,unsigned int n, PuzzlePiece& myPart) +{ + + PuzzlePiece negativePart(0); + + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m-1,n).getConnections() & 0b00110000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); + negativePart.shift(2); + + + + if ( + ( ((((negativePart.getConnections() & 0b11000000) ^ (myPart.getConnections() & 0b11000000)) != 0b00000000) && (((myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000)) + || ((((negativePart.getConnections() & 0b11000000) == 0b11000000) || ((myPart.getConnections() & 0b11000000) == 0b11000000)) && (( myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000) + || (((negativePart.getConnections() & 0b11000000) == 0b00000000) && ((myPart.getConnections() & 0b11000000) == 0b00000000)) ) + && + ( ((((negativePart.getConnections() & 0b00110000) ^ (myPart.getConnections() & 0b00110000)) != 0b00000000) && (((myPart.getConnections() & 0b00110000) != 0b00000000) && (negativePart.getConnections() & 0b00110000) != 0b00000000)) + || ((((negativePart.getConnections() & 0b00110000) == 0b00110000) || ((myPart.getConnections() & 0b00110000) == 0b00110000)) && (((myPart.getConnections() & 0b00110000) != 0b00000000) && (negativePart.getConnections() & 0b00110000) != 0b00000000)) + || (((negativePart.getConnections() & 0b00110000) == 0b00000000) && ((myPart.getConnections() & 0b00110000) == 0b00000000)) ) + && + ( ((((negativePart.getConnections() & 0b00001100) ^ (myPart.getConnections() & 0b00001100)) != 0b00000000) && (((myPart.getConnections() & 0b00001100) != 0b00000000) && (negativePart.getConnections() & 0b00001100) != 0b00000000)) + || ((((negativePart.getConnections() & 0b00001100) == 0b00001100) || ((myPart.getConnections() & 0b00001100) == 0b00001100)) && (((myPart.getConnections() & 0b00001100) != 0b00000000) && (negativePart.getConnections() & 0b00001100) != 0b00000000)) + || (((negativePart.getConnections() & 0b00001100) == 0b00000000) && ((myPart.getConnections() & 0b00001100) == 0b00000000)) ) + && + ( ((((negativePart.getConnections() & 0b00000011) ^ (myPart.getConnections() & 0b00000011)) != 0b00000000) && (((myPart.getConnections() & 0b00000011) != 0b00000000) && (negativePart.getConnections() & 0b00000011) != 0b00000000)) + || ((((negativePart.getConnections() & 0b00000011) == 0b00000011) || ((myPart.getConnections() & 0b00000011) == 0b00000011)) && (((myPart.getConnections() & 0b00000011) != 0b00000000) && (negativePart.getConnections() & 0b00000011) != 0b00000000)) + || (((negativePart.getConnections() & 0b00000011) == 0b00000000) && ((myPart.getConnections() & 0b00000011) == 0b00000000)) ) + ) + { +#ifdef debug +cout << "good Part: "; +myPart.printPiece(); +cout << endl; +#endif + return 1; + } + + + + return 0; +} + + +//TODO!! +//simpler algorithm to the first placeofpartgood +//not yet functional!!! +bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart) +{ + + PuzzlePiece negativePart(0); + + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m-1,n).getConnections() & 0b00110000)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); + negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); + negativePart.shift(2); + + //A and D or B and C or not A and not B and not C and not D + + if ( + ( ( (negativePart.getConnections() & 0b10000000) & (myPart.getConnections() & 0b01000000)) + || ( (negativePart.getConnections() & 0b01000000) & (myPart.getConnections() & 0b10000000)) + || ((!(negativePart.getConnections() & 0b10000000) & !(myPart.getConnections() & 0b10000000)) & (!(negativePart.getConnections() & 0b01000000) & !(myPart.getConnections() & 0b01000000))) + ) + && + ( ( (negativePart.getConnections() & 0b00100000) & (myPart.getConnections() & 0b00010000)) + || ( (negativePart.getConnections() & 0b00010000) & (myPart.getConnections() & 0b00100000)) + || ((!(negativePart.getConnections() & 0b00100000) & !(myPart.getConnections() & 0b00100000)) & (!(negativePart.getConnections() & 0b00010000) & !(myPart.getConnections() & 0b00010000))) + ) + && + ( ( (negativePart.getConnections() & 0b00001000) & (myPart.getConnections() & 0b00000100)) + || ( (negativePart.getConnections() & 0b00000100) & (myPart.getConnections() & 0b00001000)) + || ((!(negativePart.getConnections() & 0b00001000) & !(myPart.getConnections() & 0b00001000)) & (!(negativePart.getConnections() & 0b00000100) & !(myPart.getConnections() & 0b00000100))) + ) + && + ( ( (negativePart.getConnections() & 0b00000010) & (myPart.getConnections() & 0b00000001)) + || ( (negativePart.getConnections() & 0b00000001) & (myPart.getConnections() & 0b00000010)) + || ((!(negativePart.getConnections() & 0b00000010) & !(myPart.getConnections() & 0b00000010)) & (!(negativePart.getConnections() & 0b00000001) & !(myPart.getConnections() & 0b00000001))) + ) + ) + + return 1; + + cout << "nogood" << endl; + return 0; +} + +//prints the true puzzle (without 0 edges) +void Puzzle::printPuzzle() +{ + cout << "current Puzzle: " << endl; + for(int i=1;i::iterator i = Box.begin(); i != Box.end(); i++) + { + (*i).printPiece(); + cout << ' '; + } + cout << endl; +} + +//shuffles around a box, randomizing pieces and orientation +vector randomBox::shuffle() +{ + random_shuffle(Box.begin(),Box.end()); + for (vector::iterator i = Box.begin(); i != Box.end(); i++) + (*i).shift(rand()%4); + numerateBox(Box); + return Box; +} + +//creates a random box size m, n, shuffles it, and then retuns it +vector createBox(uint m, uint n) +{ + randomBox myFirstPuzzleBox(m,n); + myFirstPuzzleBox.createRandomPuzzle(); + return myFirstPuzzleBox.shuffle(); +} + +//prints contents of box +void printBox(vector myBox) +{ + cout << "current Box: " << endl; + for (vector::iterator i = myBox.begin(); i != myBox.end(); i++) + { + (*i).printPiece(); + cout << ' '; + } + cout << endl; + return; +} + +//gives every element in box a box identifier. +void numerateBox(vector& myBox) +{ + for(int i = 0; i< myBox.size();i++) + myBox[i].setBoxIdentifier(i); + + return; +} \ No newline at end of file diff --git a/TeamCMU/Revision_03/test_puzzle.h b/TeamCMU/Revision_03/test_puzzle.h new file mode 100644 index 0000000..f893bf0 --- /dev/null +++ b/TeamCMU/Revision_03/test_puzzle.h @@ -0,0 +1,406 @@ + + void create4040hardBox(vector& myFirstBox) +{ +myFirstBox[0].setConnections(0b01101001); +myFirstBox[1].setConnections(0b10011001); +myFirstBox[2].setConnections(0b01100110); +myFirstBox[3].setConnections(0b01101001); +myFirstBox[4].setConnections(0b10100101); +myFirstBox[5].setConnections(0b10010010); +myFirstBox[6].setConnections(0b01101001); +myFirstBox[7].setConnections(0b00101010); +myFirstBox[8].setConnections(0b01000110); +myFirstBox[9].setConnections(0b01011010); +myFirstBox[10].setConnections(0b01011010); +myFirstBox[11].setConnections(0b10010101); +myFirstBox[12].setConnections(0b01010101); +myFirstBox[13].setConnections(0b10101001); +myFirstBox[14].setConnections(0b10010101); +myFirstBox[15].setConnections(0b10101010); +myFirstBox[16].setConnections(0b01101010); +myFirstBox[17].setConnections(0b01101010); +myFirstBox[18].setConnections(0b00100101); +myFirstBox[19].setConnections(0b01100101); +myFirstBox[20].setConnections(0b10010001); +myFirstBox[21].setConnections(0b10010101); +myFirstBox[22].setConnections(0b10101001); +myFirstBox[23].setConnections(0b01010110); +myFirstBox[24].setConnections(0b10101010); +myFirstBox[25].setConnections(0b01101000); +myFirstBox[26].setConnections(0b01101010); +myFirstBox[27].setConnections(0b10010101); +myFirstBox[28].setConnections(0b10011010); +myFirstBox[29].setConnections(0b10011001); +myFirstBox[30].setConnections(0b01101010); +myFirstBox[31].setConnections(0b01100001); +myFirstBox[32].setConnections(0b01101010); +myFirstBox[33].setConnections(0b01100101); +myFirstBox[34].setConnections(0b01010101); +myFirstBox[35].setConnections(0b01010110); +myFirstBox[36].setConnections(0b01101010); +myFirstBox[37].setConnections(0b01010110); +myFirstBox[38].setConnections(0b01100110); +myFirstBox[39].setConnections(0b01011010); +myFirstBox[40].setConnections(0b01100101); +myFirstBox[41].setConnections(0b01101001); +myFirstBox[42].setConnections(0b01010110); +myFirstBox[43].setConnections(0b01000110); +myFirstBox[44].setConnections(0b01011001); +myFirstBox[45].setConnections(0b01101001); +myFirstBox[46].setConnections(0b10000101); +myFirstBox[47].setConnections(0b10011010); +myFirstBox[48].setConnections(0b10010110); +myFirstBox[49].setConnections(0b01011010); +myFirstBox[50].setConnections(0b10011001); +myFirstBox[51].setConnections(0b01001001); +myFirstBox[52].setConnections(0b10100110); +myFirstBox[53].setConnections(0b01001010); +myFirstBox[54].setConnections(0b10010010); +myFirstBox[55].setConnections(0b01001010); +myFirstBox[56].setConnections(0b01101001); +myFirstBox[57].setConnections(0b10100110); +myFirstBox[58].setConnections(0b10010110); +myFirstBox[59].setConnections(0b10010110); +myFirstBox[60].setConnections(0b10101001); +myFirstBox[61].setConnections(0b00100101); +myFirstBox[62].setConnections(0b00101001); +myFirstBox[63].setConnections(0b01101001); +myFirstBox[64].setConnections(0b01101001); +myFirstBox[65].setConnections(0b00100101); +myFirstBox[66].setConnections(0b10010110); +myFirstBox[67].setConnections(0b10011010); +myFirstBox[68].setConnections(0b01100110); +myFirstBox[69].setConnections(0b10010110); +myFirstBox[70].setConnections(0b01010100); +myFirstBox[71].setConnections(0b01011010); +myFirstBox[72].setConnections(0b01100110); +myFirstBox[73].setConnections(0b01100101); +myFirstBox[74].setConnections(0b10011010); +myFirstBox[75].setConnections(0b10010101); +myFirstBox[76].setConnections(0b10011010); +myFirstBox[77].setConnections(0b01100101); +myFirstBox[78].setConnections(0b10011010); +myFirstBox[79].setConnections(0b01010110); +myFirstBox[80].setConnections(0b01101010); +myFirstBox[81].setConnections(0b01010101); +myFirstBox[82].setConnections(0b01100101); +myFirstBox[83].setConnections(0b10100101); +myFirstBox[84].setConnections(0b01010110); +myFirstBox[85].setConnections(0b01101010); +myFirstBox[86].setConnections(0b10011010); +myFirstBox[87].setConnections(0b10010110); +myFirstBox[88].setConnections(0b01101010); +myFirstBox[89].setConnections(0b01011010); +myFirstBox[90].setConnections(0b01010110); +myFirstBox[91].setConnections(0b01100101); +myFirstBox[92].setConnections(0b00100101); +myFirstBox[93].setConnections(0b10100101); +myFirstBox[94].setConnections(0b10010110); +myFirstBox[95].setConnections(0b01100110); +myFirstBox[96].setConnections(0b10000110); +myFirstBox[97].setConnections(0b01001001); +myFirstBox[98].setConnections(0b10010110); +myFirstBox[99].setConnections(0b10100110); +myFirstBox[100].setConnections(0b10100110); +myFirstBox[101].setConnections(0b01100010); +myFirstBox[102].setConnections(0b01101010); +myFirstBox[103].setConnections(0b10011001); +myFirstBox[104].setConnections(0b01010101); +myFirstBox[105].setConnections(0b10011010); +myFirstBox[106].setConnections(0b10101001); +myFirstBox[107].setConnections(0b01100110); +myFirstBox[108].setConnections(0b10101001); +myFirstBox[109].setConnections(0b10101001); +myFirstBox[110].setConnections(0b10010100); +myFirstBox[111].setConnections(0b01100110); +myFirstBox[112].setConnections(0b01010110); +myFirstBox[113].setConnections(0b10010101); +myFirstBox[114].setConnections(0b01011001); +myFirstBox[115].setConnections(0b01101010); +myFirstBox[116].setConnections(0b10100110); +myFirstBox[117].setConnections(0b10100101); +myFirstBox[118].setConnections(0b10101010); +myFirstBox[119].setConnections(0b01011010); +myFirstBox[120].setConnections(0b10011000); +myFirstBox[121].setConnections(0b10010101); +myFirstBox[122].setConnections(0b10100101); +myFirstBox[123].setConnections(0b10000110); +myFirstBox[124].setConnections(0b01100101); +myFirstBox[125].setConnections(0b10100110); +myFirstBox[126].setConnections(0b10101010); +myFirstBox[127].setConnections(0b01101001); +myFirstBox[128].setConnections(0b01010101); +myFirstBox[129].setConnections(0b01100101); +myFirstBox[130].setConnections(0b10001001); +myFirstBox[131].setConnections(0b01101010); +myFirstBox[132].setConnections(0b01101010); +myFirstBox[133].setConnections(0b01100010); +myFirstBox[134].setConnections(0b01100110); +myFirstBox[135].setConnections(0b10100001); +myFirstBox[136].setConnections(0b10011001); +myFirstBox[137].setConnections(0b01101010); +myFirstBox[138].setConnections(0b01011001); +myFirstBox[139].setConnections(0b10001001); +myFirstBox[140].setConnections(0b01010101); +myFirstBox[141].setConnections(0b10100101); +myFirstBox[142].setConnections(0b01100101); +myFirstBox[143].setConnections(0b10100101); +myFirstBox[144].setConnections(0b10011010); +myFirstBox[145].setConnections(0b10010001); +myFirstBox[146].setConnections(0b10100110); +myFirstBox[147].setConnections(0b01101010); +myFirstBox[148].setConnections(0b10010101); +myFirstBox[149].setConnections(0b01100101); +myFirstBox[150].setConnections(0b10100101); +myFirstBox[151].setConnections(0b10100110); +myFirstBox[152].setConnections(0b10010001); +myFirstBox[153].setConnections(0b10101000); +myFirstBox[154].setConnections(0b10011010); +myFirstBox[155].setConnections(0b10100110); +myFirstBox[156].setConnections(0b01100110); +myFirstBox[157].setConnections(0b10100110); +myFirstBox[158].setConnections(0b01011010); +myFirstBox[159].setConnections(0b10100001); +myFirstBox[160].setConnections(0b01010101); +myFirstBox[161].setConnections(0b10011010); +myFirstBox[162].setConnections(0b10101001); +myFirstBox[163].setConnections(0b01010110); +myFirstBox[164].setConnections(0b01100001); +myFirstBox[165].setConnections(0b01011001); +myFirstBox[166].setConnections(0b01101001); +myFirstBox[167].setConnections(0b10011001); +myFirstBox[168].setConnections(0b10010101); +myFirstBox[169].setConnections(0b01100010); +myFirstBox[170].setConnections(0b01010110); +myFirstBox[171].setConnections(0b00010101); +myFirstBox[172].setConnections(0b10100101); +myFirstBox[173].setConnections(0b10101010); +myFirstBox[174].setConnections(0b10011010); +myFirstBox[175].setConnections(0b01100101); +myFirstBox[176].setConnections(0b10100110); +myFirstBox[177].setConnections(0b10101001); +myFirstBox[178].setConnections(0b01011010); +myFirstBox[179].setConnections(0b01101001); +myFirstBox[180].setConnections(0b10010101); +myFirstBox[181].setConnections(0b01101010); +myFirstBox[182].setConnections(0b10010110); +myFirstBox[183].setConnections(0b10010110); +myFirstBox[184].setConnections(0b10011001); +myFirstBox[185].setConnections(0b10100101); +myFirstBox[186].setConnections(0b10010110); +myFirstBox[187].setConnections(0b10010110); +myFirstBox[188].setConnections(0b10011010); +myFirstBox[189].setConnections(0b10010101); +myFirstBox[190].setConnections(0b01010001); +myFirstBox[191].setConnections(0b01010100); +myFirstBox[192].setConnections(0b10101000); +myFirstBox[193].setConnections(0b10100110); +myFirstBox[194].setConnections(0b01010001); +myFirstBox[195].setConnections(0b01010101); +myFirstBox[196].setConnections(0b01100110); +myFirstBox[197].setConnections(0b10100101); +myFirstBox[198].setConnections(0b00100101); +myFirstBox[199].setConnections(0b00100101); +myFirstBox[200].setConnections(0b10101001); +myFirstBox[201].setConnections(0b10101001); +myFirstBox[202].setConnections(0b01011001); +myFirstBox[203].setConnections(0b00001010); +myFirstBox[204].setConnections(0b01010101); +myFirstBox[205].setConnections(0b10011010); +myFirstBox[206].setConnections(0b10100110); +myFirstBox[207].setConnections(0b10100101); +myFirstBox[208].setConnections(0b10011001); +myFirstBox[209].setConnections(0b10100110); +myFirstBox[210].setConnections(0b10101010); +myFirstBox[211].setConnections(0b01010110); +myFirstBox[212].setConnections(0b01010101); +myFirstBox[213].setConnections(0b01100010); +myFirstBox[214].setConnections(0b10010110); +myFirstBox[215].setConnections(0b10011010); +myFirstBox[216].setConnections(0b01100100); +myFirstBox[217].setConnections(0b01010101); +myFirstBox[218].setConnections(0b10011010); +myFirstBox[219].setConnections(0b01100101); +myFirstBox[220].setConnections(0b10101001); +myFirstBox[221].setConnections(0b10010101); +myFirstBox[222].setConnections(0b10100101); +myFirstBox[223].setConnections(0b10101001); +myFirstBox[224].setConnections(0b10100110); +myFirstBox[225].setConnections(0b10011001); +myFirstBox[226].setConnections(0b01011010); +myFirstBox[227].setConnections(0b01000101); +myFirstBox[228].setConnections(0b01100110); +myFirstBox[229].setConnections(0b10101010); +myFirstBox[230].setConnections(0b01010100); +myFirstBox[231].setConnections(0b10101010); +myFirstBox[232].setConnections(0b10011010); +myFirstBox[233].setConnections(0b10100110); +myFirstBox[234].setConnections(0b10011000); +myFirstBox[235].setConnections(0b10011001); +myFirstBox[236].setConnections(0b01010101); +myFirstBox[237].setConnections(0b01001010); +myFirstBox[238].setConnections(0b01100001); +myFirstBox[239].setConnections(0b10011010); +myFirstBox[240].setConnections(0b10010101); +myFirstBox[241].setConnections(0b10100110); +myFirstBox[242].setConnections(0b01010101); +myFirstBox[243].setConnections(0b10010101); +myFirstBox[244].setConnections(0b01101010); +myFirstBox[245].setConnections(0b01101010); +myFirstBox[246].setConnections(0b10100100); +myFirstBox[247].setConnections(0b00101010); +myFirstBox[248].setConnections(0b01100110); +myFirstBox[249].setConnections(0b01101000); +myFirstBox[250].setConnections(0b01101001); +myFirstBox[251].setConnections(0b10101001); +myFirstBox[252].setConnections(0b01010110); +myFirstBox[253].setConnections(0b10010110); +myFirstBox[254].setConnections(0b01100101); +myFirstBox[255].setConnections(0b01011001); +myFirstBox[256].setConnections(0b01100110); +myFirstBox[257].setConnections(0b00100101); +myFirstBox[258].setConnections(0b01101001); +myFirstBox[259].setConnections(0b10010110); +myFirstBox[260].setConnections(0b10011001); +myFirstBox[261].setConnections(0b10011001); +myFirstBox[262].setConnections(0b01101001); +myFirstBox[263].setConnections(0b01010010); +myFirstBox[264].setConnections(0b10101010); +myFirstBox[265].setConnections(0b01101001); +myFirstBox[266].setConnections(0b01101001); +myFirstBox[267].setConnections(0b01101001); +myFirstBox[268].setConnections(0b10010110); +myFirstBox[269].setConnections(0b10011001); +myFirstBox[270].setConnections(0b01101010); +myFirstBox[271].setConnections(0b10000110); +myFirstBox[272].setConnections(0b10010101); +myFirstBox[273].setConnections(0b00010101); +myFirstBox[274].setConnections(0b10101010); +myFirstBox[275].setConnections(0b01010110); +myFirstBox[276].setConnections(0b01100100); +myFirstBox[277].setConnections(0b01010101); +myFirstBox[278].setConnections(0b10010101); +myFirstBox[279].setConnections(0b01010101); +myFirstBox[280].setConnections(0b01011010); +myFirstBox[281].setConnections(0b10011010); +myFirstBox[282].setConnections(0b00010101); +myFirstBox[283].setConnections(0b10010110); +myFirstBox[284].setConnections(0b10100101); +myFirstBox[285].setConnections(0b10010101); +myFirstBox[286].setConnections(0b01101001); +myFirstBox[287].setConnections(0b10100101); +myFirstBox[288].setConnections(0b01101001); +myFirstBox[289].setConnections(0b10011001); +myFirstBox[290].setConnections(0b01011001); +myFirstBox[291].setConnections(0b10010110); +myFirstBox[292].setConnections(0b01010101); +myFirstBox[293].setConnections(0b10100110); +myFirstBox[294].setConnections(0b10101001); +myFirstBox[295].setConnections(0b10101001); +myFirstBox[296].setConnections(0b01011010); +myFirstBox[297].setConnections(0b10100101); +myFirstBox[298].setConnections(0b01011010); +myFirstBox[299].setConnections(0b01100110); +myFirstBox[300].setConnections(0b10010101); +myFirstBox[301].setConnections(0b10101001); +myFirstBox[302].setConnections(0b10011001); +myFirstBox[303].setConnections(0b01010101); +myFirstBox[304].setConnections(0b01010101); +myFirstBox[305].setConnections(0b10101001); +myFirstBox[306].setConnections(0b01100101); +myFirstBox[307].setConnections(0b01101000); +myFirstBox[308].setConnections(0b01010101); +myFirstBox[309].setConnections(0b10010110); +myFirstBox[310].setConnections(0b10010110); +myFirstBox[311].setConnections(0b01011010); +myFirstBox[312].setConnections(0b10010110); +myFirstBox[313].setConnections(0b01011001); +myFirstBox[314].setConnections(0b01010110); +myFirstBox[315].setConnections(0b01101001); +myFirstBox[316].setConnections(0b10100101); +myFirstBox[317].setConnections(0b10101010); +myFirstBox[318].setConnections(0b10011001); +myFirstBox[319].setConnections(0b01010110); +myFirstBox[320].setConnections(0b10100000); +myFirstBox[321].setConnections(0b10100101); +myFirstBox[322].setConnections(0b00010101); +myFirstBox[323].setConnections(0b01010110); +myFirstBox[324].setConnections(0b01101010); +myFirstBox[325].setConnections(0b10010110); +myFirstBox[326].setConnections(0b00001001); +myFirstBox[327].setConnections(0b10011010); +myFirstBox[328].setConnections(0b10101010); +myFirstBox[329].setConnections(0b01100101); +myFirstBox[330].setConnections(0b01011010); +myFirstBox[331].setConnections(0b01101010); +myFirstBox[332].setConnections(0b10100101); +myFirstBox[333].setConnections(0b10100101); +myFirstBox[334].setConnections(0b01011000); +myFirstBox[335].setConnections(0b01010110); +myFirstBox[336].setConnections(0b00100110); +myFirstBox[337].setConnections(0b01101010); +myFirstBox[338].setConnections(0b01101010); +myFirstBox[339].setConnections(0b10010110); +myFirstBox[340].setConnections(0b10101010); +myFirstBox[341].setConnections(0b01100110); +myFirstBox[342].setConnections(0b10011000); +myFirstBox[343].setConnections(0b10101010); +myFirstBox[344].setConnections(0b01011001); +myFirstBox[345].setConnections(0b01101001); +myFirstBox[346].setConnections(0b10010101); +myFirstBox[347].setConnections(0b10101010); +myFirstBox[348].setConnections(0b10011001); +myFirstBox[349].setConnections(0b01101001); +myFirstBox[350].setConnections(0b01010110); +myFirstBox[351].setConnections(0b10000110); +myFirstBox[352].setConnections(0b10010110); +myFirstBox[353].setConnections(0b10011010); +myFirstBox[354].setConnections(0b01010110); +myFirstBox[355].setConnections(0b10010010); +myFirstBox[356].setConnections(0b10100110); +myFirstBox[357].setConnections(0b10101001); +myFirstBox[358].setConnections(0b01011001); +myFirstBox[359].setConnections(0b01010000); +myFirstBox[360].setConnections(0b10011001); +myFirstBox[361].setConnections(0b01101001); +myFirstBox[362].setConnections(0b01100001); +myFirstBox[363].setConnections(0b10100110); +myFirstBox[364].setConnections(0b10100101); +myFirstBox[365].setConnections(0b01100101); +myFirstBox[366].setConnections(0b01001010); +myFirstBox[367].setConnections(0b10010110); +myFirstBox[368].setConnections(0b10010101); +myFirstBox[369].setConnections(0b10010100); +myFirstBox[370].setConnections(0b01010101); +myFirstBox[371].setConnections(0b01011000); +myFirstBox[372].setConnections(0b01100010); +myFirstBox[373].setConnections(0b10011001); +myFirstBox[374].setConnections(0b01100110); +myFirstBox[375].setConnections(0b10100101); +myFirstBox[376].setConnections(0b01000110); +myFirstBox[377].setConnections(0b01010101); +myFirstBox[378].setConnections(0b01100110); +myFirstBox[379].setConnections(0b10100110); +myFirstBox[380].setConnections(0b00100110); +myFirstBox[381].setConnections(0b01101001); +myFirstBox[382].setConnections(0b01100101); +myFirstBox[383].setConnections(0b10010101); +myFirstBox[384].setConnections(0b01101001); +myFirstBox[385].setConnections(0b10010110); +myFirstBox[386].setConnections(0b10010101); +myFirstBox[387].setConnections(0b10101001); +myFirstBox[388].setConnections(0b10011001); +myFirstBox[389].setConnections(0b01010110); +myFirstBox[390].setConnections(0b10100010); +myFirstBox[391].setConnections(0b10101001); +myFirstBox[392].setConnections(0b01101010); +myFirstBox[393].setConnections(0b10101010); +myFirstBox[394].setConnections(0b01100110); +myFirstBox[395].setConnections(0b01010101); +myFirstBox[396].setConnections(0b01101001); +myFirstBox[397].setConnections(0b10010101); +myFirstBox[398].setConnections(0b10100110); +myFirstBox[399].setConnections(0b01101010); +return; + +} \ No newline at end of file diff --git a/TeamCMU/Revision_03/test_puzzle_long40x40.h b/TeamCMU/Revision_03/test_puzzle_long40x40.h new file mode 100644 index 0000000..5c24f00 --- /dev/null +++ b/TeamCMU/Revision_03/test_puzzle_long40x40.h @@ -0,0 +1,400 @@ +myFirstBox[0].setConections(01101001); +myFirstBox[1].setConections(10011001); +myFirstBox[2].setConections(01100110); +myFirstBox[3].setConections(01101001); +myFirstBox[4].setConections(10100101); +myFirstBox[5].setConections(10010010); +myFirstBox[6].setConections(01101001); +myFirstBox[7].setConections(00101010); +myFirstBox[8].setConections(01000110); +myFirstBox[9].setConections(01011010); +myFirstBox[10].setConections(01011010); +myFirstBox[11].setConections(10010101); +myFirstBox[12].setConections(01010101); +myFirstBox[13].setConections(10101001); +myFirstBox[14].setConections(10010101); +myFirstBox[15].setConections(10101010); +myFirstBox[16].setConections(01101010); +myFirstBox[17].setConections(01101010); +myFirstBox[18].setConections(00100101); +myFirstBox[19].setConections(01100101); +myFirstBox[20].setConections(10010001); +myFirstBox[21].setConections(10010101); +myFirstBox[22].setConections(10101001); +myFirstBox[23].setConections(01010110); +myFirstBox[24].setConections(10101010); +myFirstBox[25].setConections(01101000); +myFirstBox[26].setConections(01101010); +myFirstBox[27].setConections(10010101); +myFirstBox[28].setConections(10011010); +myFirstBox[29].setConections(10011001); +myFirstBox[30].setConections(01101010); +myFirstBox[31].setConections(01100001); +myFirstBox[32].setConections(01101010); +myFirstBox[33].setConections(01100101); +myFirstBox[34].setConections(01010101); +myFirstBox[35].setConections(01010110); +myFirstBox[36].setConections(01101010); +myFirstBox[37].setConections(01010110); +myFirstBox[38].setConections(01100110); +myFirstBox[39].setConections(01011010); +myFirstBox[40].setConections(01100101); +myFirstBox[41].setConections(01101001); +myFirstBox[42].setConections(01010110); +myFirstBox[43].setConections(01000110); +myFirstBox[44].setConections(01011001); +myFirstBox[45].setConections(01101001); +myFirstBox[46].setConections(10000101); +myFirstBox[47].setConections(10011010); +myFirstBox[48].setConections(10010110); +myFirstBox[49].setConections(01011010); +myFirstBox[50].setConections(10011001); +myFirstBox[51].setConections(01001001); +myFirstBox[52].setConections(10100110); +myFirstBox[53].setConections(01001010); +myFirstBox[54].setConections(10010010); +myFirstBox[55].setConections(01001010); +myFirstBox[56].setConections(01101001); +myFirstBox[57].setConections(10100110); +myFirstBox[58].setConections(10010110); +myFirstBox[59].setConections(10010110); +myFirstBox[60].setConections(10101001); +myFirstBox[61].setConections(00100101); +myFirstBox[62].setConections(00101001); +myFirstBox[63].setConections(01101001); +myFirstBox[64].setConections(01101001); +myFirstBox[65].setConections(00100101); +myFirstBox[66].setConections(10010110); +myFirstBox[67].setConections(10011010); +myFirstBox[68].setConections(01100110); +myFirstBox[69].setConections(10010110); +myFirstBox[70].setConections(01010100); +myFirstBox[71].setConections(01011010); +myFirstBox[72].setConections(01100110); +myFirstBox[73].setConections(01100101); +myFirstBox[74].setConections(10011010); +myFirstBox[75].setConections(10010101); +myFirstBox[76].setConections(10011010); +myFirstBox[77].setConections(01100101); +myFirstBox[78].setConections(10011010); +myFirstBox[79].setConections(01010110); +myFirstBox[80].setConections(01101010); +myFirstBox[81].setConections(01010101); +myFirstBox[82].setConections(01100101); +myFirstBox[83].setConections(10100101); +myFirstBox[84].setConections(01010110); +myFirstBox[85].setConections(01101010); +myFirstBox[86].setConections(10011010); +myFirstBox[87].setConections(10010110); +myFirstBox[88].setConections(01101010); +myFirstBox[89].setConections(01011010); +myFirstBox[90].setConections(01010110); +myFirstBox[91].setConections(01100101); +myFirstBox[92].setConections(00100101); +myFirstBox[93].setConections(10100101); +myFirstBox[94].setConections(10010110); +myFirstBox[95].setConections(01100110); +myFirstBox[96].setConections(10000110); +myFirstBox[97].setConections(01001001); +myFirstBox[98].setConections(10010110); +myFirstBox[99].setConections(10100110); +myFirstBox[100].setConections(10100110); +myFirstBox[101].setConections(01100010); +myFirstBox[102].setConections(01101010); +myFirstBox[103].setConections(10011001); +myFirstBox[104].setConections(01010101); +myFirstBox[105].setConections(10011010); +myFirstBox[106].setConections(10101001); +myFirstBox[107].setConections(01100110); +myFirstBox[108].setConections(10101001); +myFirstBox[109].setConections(10101001); +myFirstBox[110].setConections(10010100); +myFirstBox[111].setConections(01100110); +myFirstBox[112].setConections(01010110); +myFirstBox[113].setConections(10010101); +myFirstBox[114].setConections(01011001); +myFirstBox[115].setConections(01101010); +myFirstBox[116].setConections(10100110); +myFirstBox[117].setConections(10100101); +myFirstBox[118].setConections(10101010); +myFirstBox[119].setConections(01011010); +myFirstBox[120].setConections(10011000); +myFirstBox[121].setConections(10010101); +myFirstBox[122].setConections(10100101); +myFirstBox[123].setConections(10000110); +myFirstBox[124].setConections(01100101); +myFirstBox[125].setConections(10100110); +myFirstBox[126].setConections(10101010); +myFirstBox[127].setConections(01101001); +myFirstBox[128].setConections(01010101); +myFirstBox[129].setConections(01100101); +myFirstBox[130].setConections(10001001); +myFirstBox[131].setConections(01101010); +myFirstBox[132].setConections(01101010); +myFirstBox[133].setConections(01100010); +myFirstBox[134].setConections(01100110); +myFirstBox[135].setConections(10100001); +myFirstBox[136].setConections(10011001); +myFirstBox[137].setConections(01101010); +myFirstBox[138].setConections(01011001); +myFirstBox[139].setConections(10001001); +myFirstBox[140].setConections(01010101); +myFirstBox[141].setConections(10100101); +myFirstBox[142].setConections(01100101); +myFirstBox[143].setConections(10100101); +myFirstBox[144].setConections(10011010); +myFirstBox[145].setConections(10010001); +myFirstBox[146].setConections(10100110); +myFirstBox[147].setConections(01101010); +myFirstBox[148].setConections(10010101); +myFirstBox[149].setConections(01100101); +myFirstBox[150].setConections(10100101); +myFirstBox[151].setConections(10100110); +myFirstBox[152].setConections(10010001); +myFirstBox[153].setConections(10101000); +myFirstBox[154].setConections(10011010); +myFirstBox[155].setConections(10100110); +myFirstBox[156].setConections(01100110); +myFirstBox[157].setConections(10100110); +myFirstBox[158].setConections(01011010); +myFirstBox[159].setConections(10100001); +myFirstBox[160].setConections(01010101); +myFirstBox[161].setConections(10011010); +myFirstBox[162].setConections(10101001); +myFirstBox[163].setConections(01010110); +myFirstBox[164].setConections(01100001); +myFirstBox[165].setConections(01011001); +myFirstBox[166].setConections(01101001); +myFirstBox[167].setConections(10011001); +myFirstBox[168].setConections(10010101); +myFirstBox[169].setConections(01100010); +myFirstBox[170].setConections(01010110); +myFirstBox[171].setConections(00010101); +myFirstBox[172].setConections(10100101); +myFirstBox[173].setConections(10101010); +myFirstBox[174].setConections(10011010); +myFirstBox[175].setConections(01100101); +myFirstBox[176].setConections(10100110); +myFirstBox[177].setConections(10101001); +myFirstBox[178].setConections(01011010); +myFirstBox[179].setConections(01101001); +myFirstBox[180].setConections(10010101); +myFirstBox[181].setConections(01101010); +myFirstBox[182].setConections(10010110); +myFirstBox[183].setConections(10010110); +myFirstBox[184].setConections(10011001); +myFirstBox[185].setConections(10100101); +myFirstBox[186].setConections(10010110); +myFirstBox[187].setConections(10010110); +myFirstBox[188].setConections(10011010); +myFirstBox[189].setConections(10010101); +myFirstBox[190].setConections(01010001); +myFirstBox[191].setConections(01010100); +myFirstBox[192].setConections(10101000); +myFirstBox[193].setConections(10100110); +myFirstBox[194].setConections(01010001); +myFirstBox[195].setConections(01010101); +myFirstBox[196].setConections(01100110); +myFirstBox[197].setConections(10100101); +myFirstBox[198].setConections(00100101); +myFirstBox[199].setConections(00100101); +myFirstBox[200].setConections(10101001); +myFirstBox[201].setConections(10101001); +myFirstBox[202].setConections(01011001); +myFirstBox[203].setConections(00001010); +myFirstBox[204].setConections(01010101); +myFirstBox[205].setConections(10011010); +myFirstBox[206].setConections(10100110); +myFirstBox[207].setConections(10100101); +myFirstBox[208].setConections(10011001); +myFirstBox[209].setConections(10100110); +myFirstBox[210].setConections(10101010); +myFirstBox[211].setConections(01010110); +myFirstBox[212].setConections(01010101); +myFirstBox[213].setConections(01100010); +myFirstBox[214].setConections(10010110); +myFirstBox[215].setConections(10011010); +myFirstBox[216].setConections(01100100); +myFirstBox[217].setConections(01010101); +myFirstBox[218].setConections(10011010); +myFirstBox[219].setConections(01100101); +myFirstBox[220].setConections(10101001); +myFirstBox[221].setConections(10010101); +myFirstBox[222].setConections(10100101); +myFirstBox[223].setConections(10101001); +myFirstBox[224].setConections(10100110); +myFirstBox[225].setConections(10011001); +myFirstBox[226].setConections(01011010); +myFirstBox[227].setConections(01000101); +myFirstBox[228].setConections(01100110); +myFirstBox[229].setConections(10101010); +myFirstBox[230].setConections(01010100); +myFirstBox[231].setConections(10101010); +myFirstBox[232].setConections(10011010); +myFirstBox[233].setConections(10100110); +myFirstBox[234].setConections(10011000); +myFirstBox[235].setConections(10011001); +myFirstBox[236].setConections(01010101); +myFirstBox[237].setConections(01001010); +myFirstBox[238].setConections(01100001); +myFirstBox[239].setConections(10011010); +myFirstBox[240].setConections(10010101); +myFirstBox[241].setConections(10100110); +myFirstBox[242].setConections(01010101); +myFirstBox[243].setConections(10010101); +myFirstBox[244].setConections(01101010); +myFirstBox[245].setConections(01101010); +myFirstBox[246].setConections(10100100); +myFirstBox[247].setConections(00101010); +myFirstBox[248].setConections(01100110); +myFirstBox[249].setConections(01101000); +myFirstBox[250].setConections(01101001); +myFirstBox[251].setConections(10101001); +myFirstBox[252].setConections(01010110); +myFirstBox[253].setConections(10010110); +myFirstBox[254].setConections(01100101); +myFirstBox[255].setConections(01011001); +myFirstBox[256].setConections(01100110); +myFirstBox[257].setConections(00100101); +myFirstBox[258].setConections(01101001); +myFirstBox[259].setConections(10010110); +myFirstBox[260].setConections(10011001); +myFirstBox[261].setConections(10011001); +myFirstBox[262].setConections(01101001); +myFirstBox[263].setConections(01010010); +myFirstBox[264].setConections(10101010); +myFirstBox[265].setConections(01101001); +myFirstBox[266].setConections(01101001); +myFirstBox[267].setConections(01101001); +myFirstBox[268].setConections(10010110); +myFirstBox[269].setConections(10011001); +myFirstBox[270].setConections(01101010); +myFirstBox[271].setConections(10000110); +myFirstBox[272].setConections(10010101); +myFirstBox[273].setConections(00010101); +myFirstBox[274].setConections(10101010); +myFirstBox[275].setConections(01010110); +myFirstBox[276].setConections(01100100); +myFirstBox[277].setConections(01010101); +myFirstBox[278].setConections(10010101); +myFirstBox[279].setConections(01010101); +myFirstBox[280].setConections(01011010); +myFirstBox[281].setConections(10011010); +myFirstBox[282].setConections(00010101); +myFirstBox[283].setConections(10010110); +myFirstBox[284].setConections(10100101); +myFirstBox[285].setConections(10010101); +myFirstBox[286].setConections(01101001); +myFirstBox[287].setConections(10100101); +myFirstBox[288].setConections(01101001); +myFirstBox[289].setConections(10011001); +myFirstBox[290].setConections(01011001); +myFirstBox[291].setConections(10010110); +myFirstBox[292].setConections(01010101); +myFirstBox[293].setConections(10100110); +myFirstBox[294].setConections(10101001); +myFirstBox[295].setConections(10101001); +myFirstBox[296].setConections(01011010); +myFirstBox[297].setConections(10100101); +myFirstBox[298].setConections(01011010); +myFirstBox[299].setConections(01100110); +myFirstBox[300].setConections(10010101); +myFirstBox[301].setConections(10101001); +myFirstBox[302].setConections(10011001); +myFirstBox[303].setConections(01010101); +myFirstBox[304].setConections(01010101); +myFirstBox[305].setConections(10101001); +myFirstBox[306].setConections(01100101); +myFirstBox[307].setConections(01101000); +myFirstBox[308].setConections(01010101); +myFirstBox[309].setConections(10010110); +myFirstBox[310].setConections(10010110); +myFirstBox[311].setConections(01011010); +myFirstBox[312].setConections(10010110); +myFirstBox[313].setConections(01011001); +myFirstBox[314].setConections(01010110); +myFirstBox[315].setConections(01101001); +myFirstBox[316].setConections(10100101); +myFirstBox[317].setConections(10101010); +myFirstBox[318].setConections(10011001); +myFirstBox[319].setConections(01010110); +myFirstBox[320].setConections(10100000); +myFirstBox[321].setConections(10100101); +myFirstBox[322].setConections(00010101); +myFirstBox[323].setConections(01010110); +myFirstBox[324].setConections(01101010); +myFirstBox[325].setConections(10010110); +myFirstBox[326].setConections(00001001); +myFirstBox[327].setConections(10011010); +myFirstBox[328].setConections(10101010); +myFirstBox[329].setConections(01100101); +myFirstBox[330].setConections(01011010); +myFirstBox[331].setConections(01101010); +myFirstBox[332].setConections(10100101); +myFirstBox[333].setConections(10100101); +myFirstBox[334].setConections(01011000); +myFirstBox[335].setConections(01010110); +myFirstBox[336].setConections(00100110); +myFirstBox[337].setConections(01101010); +myFirstBox[338].setConections(01101010); +myFirstBox[339].setConections(10010110); +myFirstBox[340].setConections(10101010); +myFirstBox[341].setConections(01100110); +myFirstBox[342].setConections(10011000); +myFirstBox[343].setConections(10101010); +myFirstBox[344].setConections(01011001); +myFirstBox[345].setConections(01101001); +myFirstBox[346].setConections(10010101); +myFirstBox[347].setConections(10101010); +myFirstBox[348].setConections(10011001); +myFirstBox[349].setConections(01101001); +myFirstBox[350].setConections(01010110); +myFirstBox[351].setConections(10000110); +myFirstBox[352].setConections(10010110); +myFirstBox[353].setConections(10011010); +myFirstBox[354].setConections(01010110); +myFirstBox[355].setConections(10010010); +myFirstBox[356].setConections(10100110); +myFirstBox[357].setConections(10101001); +myFirstBox[358].setConections(01011001); +myFirstBox[359].setConections(01010000); +myFirstBox[360].setConections(10011001); +myFirstBox[361].setConections(01101001); +myFirstBox[362].setConections(01100001); +myFirstBox[363].setConections(10100110); +myFirstBox[364].setConections(10100101); +myFirstBox[365].setConections(01100101); +myFirstBox[366].setConections(01001010); +myFirstBox[367].setConections(10010110); +myFirstBox[368].setConections(10010101); +myFirstBox[369].setConections(10010100); +myFirstBox[370].setConections(01010101); +myFirstBox[371].setConections(01011000); +myFirstBox[372].setConections(01100010); +myFirstBox[373].setConections(10011001); +myFirstBox[374].setConections(01100110); +myFirstBox[375].setConections(10100101); +myFirstBox[376].setConections(01000110); +myFirstBox[377].setConections(01010101); +myFirstBox[378].setConections(01100110); +myFirstBox[379].setConections(10100110); +myFirstBox[380].setConections(00100110); +myFirstBox[381].setConections(01101001); +myFirstBox[382].setConections(01100101); +myFirstBox[383].setConections(10010101); +myFirstBox[384].setConections(01101001); +myFirstBox[385].setConections(10010110); +myFirstBox[386].setConections(10010101); +myFirstBox[387].setConections(10101001); +myFirstBox[388].setConections(10011001); +myFirstBox[389].setConections(01010110); +myFirstBox[390].setConections(10100010); +myFirstBox[391].setConections(10101001); +myFirstBox[392].setConections(01101010); +myFirstBox[393].setConections(10101010); +myFirstBox[394].setConections(01100110); +myFirstBox[395].setConections(01010101); +myFirstBox[396].setConections(01101001); +myFirstBox[397].setConections(10010101); +myFirstBox[398].setConections(10100110); +myFirstBox[399].setConections(01101010);