added codebase. changed folderstructure

This commit is contained in:
g-spacewhale 2017-11-18 08:22:35 +01:00
parent 95cf7cc7b3
commit 037d20096a
16 changed files with 3690 additions and 3141 deletions

View File

@ -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);

Binary file not shown.

View File

@ -0,0 +1,153 @@
using namespace std;
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<sizeof(unsigned char)*8> (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<n+2;i++)
{
Matrix[i] = new PuzzlePiece[m+2];
for(int j = 0;j<m+2;j++)
{
if(i==0 || j==0 || i==n+1 || j==m+1)
{
Matrix[i][j] = PuzzlePiece(0);
}
else
{
Matrix[i][j] = PuzzlePiece(1);
}
}
}
}
bool setPiece(uint m,uint n,PuzzlePiece newPiece)
{
if(PlaceOfPartGood(m,n,newPiece))
{
Matrix[n+1][m+1] = newPiece;
return 1;
}
return 0;
}
//removes piece and instead puts undefined piece
bool removePiece(uint m,uint n)
{
Matrix[n+1][m+1].setConnections(0b11111111);
return 1;
}
//getter
PuzzlePiece getPiece(uint m,uint n) { return Matrix[n+1][m+1]; }
uint getCols(){ return col; }
uint getRows(){ return row; }
//functtion definitions
void printPuzzle();
bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart);
bool PlaceOfPart2Good(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<PuzzlePiece>& myBox, unsigned int separator);
unsigned int putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& 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) {srand(time(0));} //passed m n to puzzle constructor
void createRandomPuzzle();
vector<PuzzlePiece> shuffle();
void printBox();
private:
vector<PuzzlePiece> Box;
};
class coor
{
public:
int m, n;
coor():m(-1),n(-1){}
coor(int newm,int newn): m(newm), n(newn)
{}
};
class LogEntry
{
public:
vector<PuzzlePiece*> PieceCollector;
vector<coor> CoorCollector;
int abstractionLevel;
coor myCoor;
PuzzlePiece* myPuzzlePiece;
LogEntry()
{
abstractionLevel=0;
}
private:
};
void printBox(vector<PuzzlePiece> myBox);
vector<PuzzlePiece> createBox(uint m, uint n);
void numerateBox(vector<PuzzlePiece>& myBox);

View File

@ -1,13 +1,4 @@
#include <iostream>
#include <bitset>
#include <cstdlib>
#include <time.h>
#include <vector>
#include <algorithm>
#include "header/input.h"
using namespace std;
#include "header.h"
int main()
{
@ -16,4 +7,9 @@ int main()
myFirstPart.setConnections(0b00101000);
myFirstPuzzle.push_back(myFirstPart);
cout << "Hello World" << endl;
randomBox myFirstBox(2,3);
myFirstBox.createRandomPuzzle();
myFirstBox.shuffle();
myFirstBox.printPuzzle();
}