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

@ -1,400 +1,400 @@
myFirstBox[0].setConections(01101001); myFirstBox[0].setConections(01101001);
myFirstBox[1].setConections(10011001); myFirstBox[1].setConections(10011001);
myFirstBox[2].setConections(01100110); myFirstBox[2].setConections(01100110);
myFirstBox[3].setConections(01101001); myFirstBox[3].setConections(01101001);
myFirstBox[4].setConections(10100101); myFirstBox[4].setConections(10100101);
myFirstBox[5].setConections(10010010); myFirstBox[5].setConections(10010010);
myFirstBox[6].setConections(01101001); myFirstBox[6].setConections(01101001);
myFirstBox[7].setConections(00101010); myFirstBox[7].setConections(00101010);
myFirstBox[8].setConections(01000110); myFirstBox[8].setConections(01000110);
myFirstBox[9].setConections(01011010); myFirstBox[9].setConections(01011010);
myFirstBox[10].setConections(01011010); myFirstBox[10].setConections(01011010);
myFirstBox[11].setConections(10010101); myFirstBox[11].setConections(10010101);
myFirstBox[12].setConections(01010101); myFirstBox[12].setConections(01010101);
myFirstBox[13].setConections(10101001); myFirstBox[13].setConections(10101001);
myFirstBox[14].setConections(10010101); myFirstBox[14].setConections(10010101);
myFirstBox[15].setConections(10101010); myFirstBox[15].setConections(10101010);
myFirstBox[16].setConections(01101010); myFirstBox[16].setConections(01101010);
myFirstBox[17].setConections(01101010); myFirstBox[17].setConections(01101010);
myFirstBox[18].setConections(00100101); myFirstBox[18].setConections(00100101);
myFirstBox[19].setConections(01100101); myFirstBox[19].setConections(01100101);
myFirstBox[20].setConections(10010001); myFirstBox[20].setConections(10010001);
myFirstBox[21].setConections(10010101); myFirstBox[21].setConections(10010101);
myFirstBox[22].setConections(10101001); myFirstBox[22].setConections(10101001);
myFirstBox[23].setConections(01010110); myFirstBox[23].setConections(01010110);
myFirstBox[24].setConections(10101010); myFirstBox[24].setConections(10101010);
myFirstBox[25].setConections(01101000); myFirstBox[25].setConections(01101000);
myFirstBox[26].setConections(01101010); myFirstBox[26].setConections(01101010);
myFirstBox[27].setConections(10010101); myFirstBox[27].setConections(10010101);
myFirstBox[28].setConections(10011010); myFirstBox[28].setConections(10011010);
myFirstBox[29].setConections(10011001); myFirstBox[29].setConections(10011001);
myFirstBox[30].setConections(01101010); myFirstBox[30].setConections(01101010);
myFirstBox[31].setConections(01100001); myFirstBox[31].setConections(01100001);
myFirstBox[32].setConections(01101010); myFirstBox[32].setConections(01101010);
myFirstBox[33].setConections(01100101); myFirstBox[33].setConections(01100101);
myFirstBox[34].setConections(01010101); myFirstBox[34].setConections(01010101);
myFirstBox[35].setConections(01010110); myFirstBox[35].setConections(01010110);
myFirstBox[36].setConections(01101010); myFirstBox[36].setConections(01101010);
myFirstBox[37].setConections(01010110); myFirstBox[37].setConections(01010110);
myFirstBox[38].setConections(01100110); myFirstBox[38].setConections(01100110);
myFirstBox[39].setConections(01011010); myFirstBox[39].setConections(01011010);
myFirstBox[40].setConections(01100101); myFirstBox[40].setConections(01100101);
myFirstBox[41].setConections(01101001); myFirstBox[41].setConections(01101001);
myFirstBox[42].setConections(01010110); myFirstBox[42].setConections(01010110);
myFirstBox[43].setConections(01000110); myFirstBox[43].setConections(01000110);
myFirstBox[44].setConections(01011001); myFirstBox[44].setConections(01011001);
myFirstBox[45].setConections(01101001); myFirstBox[45].setConections(01101001);
myFirstBox[46].setConections(10000101); myFirstBox[46].setConections(10000101);
myFirstBox[47].setConections(10011010); myFirstBox[47].setConections(10011010);
myFirstBox[48].setConections(10010110); myFirstBox[48].setConections(10010110);
myFirstBox[49].setConections(01011010); myFirstBox[49].setConections(01011010);
myFirstBox[50].setConections(10011001); myFirstBox[50].setConections(10011001);
myFirstBox[51].setConections(01001001); myFirstBox[51].setConections(01001001);
myFirstBox[52].setConections(10100110); myFirstBox[52].setConections(10100110);
myFirstBox[53].setConections(01001010); myFirstBox[53].setConections(01001010);
myFirstBox[54].setConections(10010010); myFirstBox[54].setConections(10010010);
myFirstBox[55].setConections(01001010); myFirstBox[55].setConections(01001010);
myFirstBox[56].setConections(01101001); myFirstBox[56].setConections(01101001);
myFirstBox[57].setConections(10100110); myFirstBox[57].setConections(10100110);
myFirstBox[58].setConections(10010110); myFirstBox[58].setConections(10010110);
myFirstBox[59].setConections(10010110); myFirstBox[59].setConections(10010110);
myFirstBox[60].setConections(10101001); myFirstBox[60].setConections(10101001);
myFirstBox[61].setConections(00100101); myFirstBox[61].setConections(00100101);
myFirstBox[62].setConections(00101001); myFirstBox[62].setConections(00101001);
myFirstBox[63].setConections(01101001); myFirstBox[63].setConections(01101001);
myFirstBox[64].setConections(01101001); myFirstBox[64].setConections(01101001);
myFirstBox[65].setConections(00100101); myFirstBox[65].setConections(00100101);
myFirstBox[66].setConections(10010110); myFirstBox[66].setConections(10010110);
myFirstBox[67].setConections(10011010); myFirstBox[67].setConections(10011010);
myFirstBox[68].setConections(01100110); myFirstBox[68].setConections(01100110);
myFirstBox[69].setConections(10010110); myFirstBox[69].setConections(10010110);
myFirstBox[70].setConections(01010100); myFirstBox[70].setConections(01010100);
myFirstBox[71].setConections(01011010); myFirstBox[71].setConections(01011010);
myFirstBox[72].setConections(01100110); myFirstBox[72].setConections(01100110);
myFirstBox[73].setConections(01100101); myFirstBox[73].setConections(01100101);
myFirstBox[74].setConections(10011010); myFirstBox[74].setConections(10011010);
myFirstBox[75].setConections(10010101); myFirstBox[75].setConections(10010101);
myFirstBox[76].setConections(10011010); myFirstBox[76].setConections(10011010);
myFirstBox[77].setConections(01100101); myFirstBox[77].setConections(01100101);
myFirstBox[78].setConections(10011010); myFirstBox[78].setConections(10011010);
myFirstBox[79].setConections(01010110); myFirstBox[79].setConections(01010110);
myFirstBox[80].setConections(01101010); myFirstBox[80].setConections(01101010);
myFirstBox[81].setConections(01010101); myFirstBox[81].setConections(01010101);
myFirstBox[82].setConections(01100101); myFirstBox[82].setConections(01100101);
myFirstBox[83].setConections(10100101); myFirstBox[83].setConections(10100101);
myFirstBox[84].setConections(01010110); myFirstBox[84].setConections(01010110);
myFirstBox[85].setConections(01101010); myFirstBox[85].setConections(01101010);
myFirstBox[86].setConections(10011010); myFirstBox[86].setConections(10011010);
myFirstBox[87].setConections(10010110); myFirstBox[87].setConections(10010110);
myFirstBox[88].setConections(01101010); myFirstBox[88].setConections(01101010);
myFirstBox[89].setConections(01011010); myFirstBox[89].setConections(01011010);
myFirstBox[90].setConections(01010110); myFirstBox[90].setConections(01010110);
myFirstBox[91].setConections(01100101); myFirstBox[91].setConections(01100101);
myFirstBox[92].setConections(00100101); myFirstBox[92].setConections(00100101);
myFirstBox[93].setConections(10100101); myFirstBox[93].setConections(10100101);
myFirstBox[94].setConections(10010110); myFirstBox[94].setConections(10010110);
myFirstBox[95].setConections(01100110); myFirstBox[95].setConections(01100110);
myFirstBox[96].setConections(10000110); myFirstBox[96].setConections(10000110);
myFirstBox[97].setConections(01001001); myFirstBox[97].setConections(01001001);
myFirstBox[98].setConections(10010110); myFirstBox[98].setConections(10010110);
myFirstBox[99].setConections(10100110); myFirstBox[99].setConections(10100110);
myFirstBox[100].setConections(10100110); myFirstBox[100].setConections(10100110);
myFirstBox[101].setConections(01100010); myFirstBox[101].setConections(01100010);
myFirstBox[102].setConections(01101010); myFirstBox[102].setConections(01101010);
myFirstBox[103].setConections(10011001); myFirstBox[103].setConections(10011001);
myFirstBox[104].setConections(01010101); myFirstBox[104].setConections(01010101);
myFirstBox[105].setConections(10011010); myFirstBox[105].setConections(10011010);
myFirstBox[106].setConections(10101001); myFirstBox[106].setConections(10101001);
myFirstBox[107].setConections(01100110); myFirstBox[107].setConections(01100110);
myFirstBox[108].setConections(10101001); myFirstBox[108].setConections(10101001);
myFirstBox[109].setConections(10101001); myFirstBox[109].setConections(10101001);
myFirstBox[110].setConections(10010100); myFirstBox[110].setConections(10010100);
myFirstBox[111].setConections(01100110); myFirstBox[111].setConections(01100110);
myFirstBox[112].setConections(01010110); myFirstBox[112].setConections(01010110);
myFirstBox[113].setConections(10010101); myFirstBox[113].setConections(10010101);
myFirstBox[114].setConections(01011001); myFirstBox[114].setConections(01011001);
myFirstBox[115].setConections(01101010); myFirstBox[115].setConections(01101010);
myFirstBox[116].setConections(10100110); myFirstBox[116].setConections(10100110);
myFirstBox[117].setConections(10100101); myFirstBox[117].setConections(10100101);
myFirstBox[118].setConections(10101010); myFirstBox[118].setConections(10101010);
myFirstBox[119].setConections(01011010); myFirstBox[119].setConections(01011010);
myFirstBox[120].setConections(10011000); myFirstBox[120].setConections(10011000);
myFirstBox[121].setConections(10010101); myFirstBox[121].setConections(10010101);
myFirstBox[122].setConections(10100101); myFirstBox[122].setConections(10100101);
myFirstBox[123].setConections(10000110); myFirstBox[123].setConections(10000110);
myFirstBox[124].setConections(01100101); myFirstBox[124].setConections(01100101);
myFirstBox[125].setConections(10100110); myFirstBox[125].setConections(10100110);
myFirstBox[126].setConections(10101010); myFirstBox[126].setConections(10101010);
myFirstBox[127].setConections(01101001); myFirstBox[127].setConections(01101001);
myFirstBox[128].setConections(01010101); myFirstBox[128].setConections(01010101);
myFirstBox[129].setConections(01100101); myFirstBox[129].setConections(01100101);
myFirstBox[130].setConections(10001001); myFirstBox[130].setConections(10001001);
myFirstBox[131].setConections(01101010); myFirstBox[131].setConections(01101010);
myFirstBox[132].setConections(01101010); myFirstBox[132].setConections(01101010);
myFirstBox[133].setConections(01100010); myFirstBox[133].setConections(01100010);
myFirstBox[134].setConections(01100110); myFirstBox[134].setConections(01100110);
myFirstBox[135].setConections(10100001); myFirstBox[135].setConections(10100001);
myFirstBox[136].setConections(10011001); myFirstBox[136].setConections(10011001);
myFirstBox[137].setConections(01101010); myFirstBox[137].setConections(01101010);
myFirstBox[138].setConections(01011001); myFirstBox[138].setConections(01011001);
myFirstBox[139].setConections(10001001); myFirstBox[139].setConections(10001001);
myFirstBox[140].setConections(01010101); myFirstBox[140].setConections(01010101);
myFirstBox[141].setConections(10100101); myFirstBox[141].setConections(10100101);
myFirstBox[142].setConections(01100101); myFirstBox[142].setConections(01100101);
myFirstBox[143].setConections(10100101); myFirstBox[143].setConections(10100101);
myFirstBox[144].setConections(10011010); myFirstBox[144].setConections(10011010);
myFirstBox[145].setConections(10010001); myFirstBox[145].setConections(10010001);
myFirstBox[146].setConections(10100110); myFirstBox[146].setConections(10100110);
myFirstBox[147].setConections(01101010); myFirstBox[147].setConections(01101010);
myFirstBox[148].setConections(10010101); myFirstBox[148].setConections(10010101);
myFirstBox[149].setConections(01100101); myFirstBox[149].setConections(01100101);
myFirstBox[150].setConections(10100101); myFirstBox[150].setConections(10100101);
myFirstBox[151].setConections(10100110); myFirstBox[151].setConections(10100110);
myFirstBox[152].setConections(10010001); myFirstBox[152].setConections(10010001);
myFirstBox[153].setConections(10101000); myFirstBox[153].setConections(10101000);
myFirstBox[154].setConections(10011010); myFirstBox[154].setConections(10011010);
myFirstBox[155].setConections(10100110); myFirstBox[155].setConections(10100110);
myFirstBox[156].setConections(01100110); myFirstBox[156].setConections(01100110);
myFirstBox[157].setConections(10100110); myFirstBox[157].setConections(10100110);
myFirstBox[158].setConections(01011010); myFirstBox[158].setConections(01011010);
myFirstBox[159].setConections(10100001); myFirstBox[159].setConections(10100001);
myFirstBox[160].setConections(01010101); myFirstBox[160].setConections(01010101);
myFirstBox[161].setConections(10011010); myFirstBox[161].setConections(10011010);
myFirstBox[162].setConections(10101001); myFirstBox[162].setConections(10101001);
myFirstBox[163].setConections(01010110); myFirstBox[163].setConections(01010110);
myFirstBox[164].setConections(01100001); myFirstBox[164].setConections(01100001);
myFirstBox[165].setConections(01011001); myFirstBox[165].setConections(01011001);
myFirstBox[166].setConections(01101001); myFirstBox[166].setConections(01101001);
myFirstBox[167].setConections(10011001); myFirstBox[167].setConections(10011001);
myFirstBox[168].setConections(10010101); myFirstBox[168].setConections(10010101);
myFirstBox[169].setConections(01100010); myFirstBox[169].setConections(01100010);
myFirstBox[170].setConections(01010110); myFirstBox[170].setConections(01010110);
myFirstBox[171].setConections(00010101); myFirstBox[171].setConections(00010101);
myFirstBox[172].setConections(10100101); myFirstBox[172].setConections(10100101);
myFirstBox[173].setConections(10101010); myFirstBox[173].setConections(10101010);
myFirstBox[174].setConections(10011010); myFirstBox[174].setConections(10011010);
myFirstBox[175].setConections(01100101); myFirstBox[175].setConections(01100101);
myFirstBox[176].setConections(10100110); myFirstBox[176].setConections(10100110);
myFirstBox[177].setConections(10101001); myFirstBox[177].setConections(10101001);
myFirstBox[178].setConections(01011010); myFirstBox[178].setConections(01011010);
myFirstBox[179].setConections(01101001); myFirstBox[179].setConections(01101001);
myFirstBox[180].setConections(10010101); myFirstBox[180].setConections(10010101);
myFirstBox[181].setConections(01101010); myFirstBox[181].setConections(01101010);
myFirstBox[182].setConections(10010110); myFirstBox[182].setConections(10010110);
myFirstBox[183].setConections(10010110); myFirstBox[183].setConections(10010110);
myFirstBox[184].setConections(10011001); myFirstBox[184].setConections(10011001);
myFirstBox[185].setConections(10100101); myFirstBox[185].setConections(10100101);
myFirstBox[186].setConections(10010110); myFirstBox[186].setConections(10010110);
myFirstBox[187].setConections(10010110); myFirstBox[187].setConections(10010110);
myFirstBox[188].setConections(10011010); myFirstBox[188].setConections(10011010);
myFirstBox[189].setConections(10010101); myFirstBox[189].setConections(10010101);
myFirstBox[190].setConections(01010001); myFirstBox[190].setConections(01010001);
myFirstBox[191].setConections(01010100); myFirstBox[191].setConections(01010100);
myFirstBox[192].setConections(10101000); myFirstBox[192].setConections(10101000);
myFirstBox[193].setConections(10100110); myFirstBox[193].setConections(10100110);
myFirstBox[194].setConections(01010001); myFirstBox[194].setConections(01010001);
myFirstBox[195].setConections(01010101); myFirstBox[195].setConections(01010101);
myFirstBox[196].setConections(01100110); myFirstBox[196].setConections(01100110);
myFirstBox[197].setConections(10100101); myFirstBox[197].setConections(10100101);
myFirstBox[198].setConections(00100101); myFirstBox[198].setConections(00100101);
myFirstBox[199].setConections(00100101); myFirstBox[199].setConections(00100101);
myFirstBox[200].setConections(10101001); myFirstBox[200].setConections(10101001);
myFirstBox[201].setConections(10101001); myFirstBox[201].setConections(10101001);
myFirstBox[202].setConections(01011001); myFirstBox[202].setConections(01011001);
myFirstBox[203].setConections(00001010); myFirstBox[203].setConections(00001010);
myFirstBox[204].setConections(01010101); myFirstBox[204].setConections(01010101);
myFirstBox[205].setConections(10011010); myFirstBox[205].setConections(10011010);
myFirstBox[206].setConections(10100110); myFirstBox[206].setConections(10100110);
myFirstBox[207].setConections(10100101); myFirstBox[207].setConections(10100101);
myFirstBox[208].setConections(10011001); myFirstBox[208].setConections(10011001);
myFirstBox[209].setConections(10100110); myFirstBox[209].setConections(10100110);
myFirstBox[210].setConections(10101010); myFirstBox[210].setConections(10101010);
myFirstBox[211].setConections(01010110); myFirstBox[211].setConections(01010110);
myFirstBox[212].setConections(01010101); myFirstBox[212].setConections(01010101);
myFirstBox[213].setConections(01100010); myFirstBox[213].setConections(01100010);
myFirstBox[214].setConections(10010110); myFirstBox[214].setConections(10010110);
myFirstBox[215].setConections(10011010); myFirstBox[215].setConections(10011010);
myFirstBox[216].setConections(01100100); myFirstBox[216].setConections(01100100);
myFirstBox[217].setConections(01010101); myFirstBox[217].setConections(01010101);
myFirstBox[218].setConections(10011010); myFirstBox[218].setConections(10011010);
myFirstBox[219].setConections(01100101); myFirstBox[219].setConections(01100101);
myFirstBox[220].setConections(10101001); myFirstBox[220].setConections(10101001);
myFirstBox[221].setConections(10010101); myFirstBox[221].setConections(10010101);
myFirstBox[222].setConections(10100101); myFirstBox[222].setConections(10100101);
myFirstBox[223].setConections(10101001); myFirstBox[223].setConections(10101001);
myFirstBox[224].setConections(10100110); myFirstBox[224].setConections(10100110);
myFirstBox[225].setConections(10011001); myFirstBox[225].setConections(10011001);
myFirstBox[226].setConections(01011010); myFirstBox[226].setConections(01011010);
myFirstBox[227].setConections(01000101); myFirstBox[227].setConections(01000101);
myFirstBox[228].setConections(01100110); myFirstBox[228].setConections(01100110);
myFirstBox[229].setConections(10101010); myFirstBox[229].setConections(10101010);
myFirstBox[230].setConections(01010100); myFirstBox[230].setConections(01010100);
myFirstBox[231].setConections(10101010); myFirstBox[231].setConections(10101010);
myFirstBox[232].setConections(10011010); myFirstBox[232].setConections(10011010);
myFirstBox[233].setConections(10100110); myFirstBox[233].setConections(10100110);
myFirstBox[234].setConections(10011000); myFirstBox[234].setConections(10011000);
myFirstBox[235].setConections(10011001); myFirstBox[235].setConections(10011001);
myFirstBox[236].setConections(01010101); myFirstBox[236].setConections(01010101);
myFirstBox[237].setConections(01001010); myFirstBox[237].setConections(01001010);
myFirstBox[238].setConections(01100001); myFirstBox[238].setConections(01100001);
myFirstBox[239].setConections(10011010); myFirstBox[239].setConections(10011010);
myFirstBox[240].setConections(10010101); myFirstBox[240].setConections(10010101);
myFirstBox[241].setConections(10100110); myFirstBox[241].setConections(10100110);
myFirstBox[242].setConections(01010101); myFirstBox[242].setConections(01010101);
myFirstBox[243].setConections(10010101); myFirstBox[243].setConections(10010101);
myFirstBox[244].setConections(01101010); myFirstBox[244].setConections(01101010);
myFirstBox[245].setConections(01101010); myFirstBox[245].setConections(01101010);
myFirstBox[246].setConections(10100100); myFirstBox[246].setConections(10100100);
myFirstBox[247].setConections(00101010); myFirstBox[247].setConections(00101010);
myFirstBox[248].setConections(01100110); myFirstBox[248].setConections(01100110);
myFirstBox[249].setConections(01101000); myFirstBox[249].setConections(01101000);
myFirstBox[250].setConections(01101001); myFirstBox[250].setConections(01101001);
myFirstBox[251].setConections(10101001); myFirstBox[251].setConections(10101001);
myFirstBox[252].setConections(01010110); myFirstBox[252].setConections(01010110);
myFirstBox[253].setConections(10010110); myFirstBox[253].setConections(10010110);
myFirstBox[254].setConections(01100101); myFirstBox[254].setConections(01100101);
myFirstBox[255].setConections(01011001); myFirstBox[255].setConections(01011001);
myFirstBox[256].setConections(01100110); myFirstBox[256].setConections(01100110);
myFirstBox[257].setConections(00100101); myFirstBox[257].setConections(00100101);
myFirstBox[258].setConections(01101001); myFirstBox[258].setConections(01101001);
myFirstBox[259].setConections(10010110); myFirstBox[259].setConections(10010110);
myFirstBox[260].setConections(10011001); myFirstBox[260].setConections(10011001);
myFirstBox[261].setConections(10011001); myFirstBox[261].setConections(10011001);
myFirstBox[262].setConections(01101001); myFirstBox[262].setConections(01101001);
myFirstBox[263].setConections(01010010); myFirstBox[263].setConections(01010010);
myFirstBox[264].setConections(10101010); myFirstBox[264].setConections(10101010);
myFirstBox[265].setConections(01101001); myFirstBox[265].setConections(01101001);
myFirstBox[266].setConections(01101001); myFirstBox[266].setConections(01101001);
myFirstBox[267].setConections(01101001); myFirstBox[267].setConections(01101001);
myFirstBox[268].setConections(10010110); myFirstBox[268].setConections(10010110);
myFirstBox[269].setConections(10011001); myFirstBox[269].setConections(10011001);
myFirstBox[270].setConections(01101010); myFirstBox[270].setConections(01101010);
myFirstBox[271].setConections(10000110); myFirstBox[271].setConections(10000110);
myFirstBox[272].setConections(10010101); myFirstBox[272].setConections(10010101);
myFirstBox[273].setConections(00010101); myFirstBox[273].setConections(00010101);
myFirstBox[274].setConections(10101010); myFirstBox[274].setConections(10101010);
myFirstBox[275].setConections(01010110); myFirstBox[275].setConections(01010110);
myFirstBox[276].setConections(01100100); myFirstBox[276].setConections(01100100);
myFirstBox[277].setConections(01010101); myFirstBox[277].setConections(01010101);
myFirstBox[278].setConections(10010101); myFirstBox[278].setConections(10010101);
myFirstBox[279].setConections(01010101); myFirstBox[279].setConections(01010101);
myFirstBox[280].setConections(01011010); myFirstBox[280].setConections(01011010);
myFirstBox[281].setConections(10011010); myFirstBox[281].setConections(10011010);
myFirstBox[282].setConections(00010101); myFirstBox[282].setConections(00010101);
myFirstBox[283].setConections(10010110); myFirstBox[283].setConections(10010110);
myFirstBox[284].setConections(10100101); myFirstBox[284].setConections(10100101);
myFirstBox[285].setConections(10010101); myFirstBox[285].setConections(10010101);
myFirstBox[286].setConections(01101001); myFirstBox[286].setConections(01101001);
myFirstBox[287].setConections(10100101); myFirstBox[287].setConections(10100101);
myFirstBox[288].setConections(01101001); myFirstBox[288].setConections(01101001);
myFirstBox[289].setConections(10011001); myFirstBox[289].setConections(10011001);
myFirstBox[290].setConections(01011001); myFirstBox[290].setConections(01011001);
myFirstBox[291].setConections(10010110); myFirstBox[291].setConections(10010110);
myFirstBox[292].setConections(01010101); myFirstBox[292].setConections(01010101);
myFirstBox[293].setConections(10100110); myFirstBox[293].setConections(10100110);
myFirstBox[294].setConections(10101001); myFirstBox[294].setConections(10101001);
myFirstBox[295].setConections(10101001); myFirstBox[295].setConections(10101001);
myFirstBox[296].setConections(01011010); myFirstBox[296].setConections(01011010);
myFirstBox[297].setConections(10100101); myFirstBox[297].setConections(10100101);
myFirstBox[298].setConections(01011010); myFirstBox[298].setConections(01011010);
myFirstBox[299].setConections(01100110); myFirstBox[299].setConections(01100110);
myFirstBox[300].setConections(10010101); myFirstBox[300].setConections(10010101);
myFirstBox[301].setConections(10101001); myFirstBox[301].setConections(10101001);
myFirstBox[302].setConections(10011001); myFirstBox[302].setConections(10011001);
myFirstBox[303].setConections(01010101); myFirstBox[303].setConections(01010101);
myFirstBox[304].setConections(01010101); myFirstBox[304].setConections(01010101);
myFirstBox[305].setConections(10101001); myFirstBox[305].setConections(10101001);
myFirstBox[306].setConections(01100101); myFirstBox[306].setConections(01100101);
myFirstBox[307].setConections(01101000); myFirstBox[307].setConections(01101000);
myFirstBox[308].setConections(01010101); myFirstBox[308].setConections(01010101);
myFirstBox[309].setConections(10010110); myFirstBox[309].setConections(10010110);
myFirstBox[310].setConections(10010110); myFirstBox[310].setConections(10010110);
myFirstBox[311].setConections(01011010); myFirstBox[311].setConections(01011010);
myFirstBox[312].setConections(10010110); myFirstBox[312].setConections(10010110);
myFirstBox[313].setConections(01011001); myFirstBox[313].setConections(01011001);
myFirstBox[314].setConections(01010110); myFirstBox[314].setConections(01010110);
myFirstBox[315].setConections(01101001); myFirstBox[315].setConections(01101001);
myFirstBox[316].setConections(10100101); myFirstBox[316].setConections(10100101);
myFirstBox[317].setConections(10101010); myFirstBox[317].setConections(10101010);
myFirstBox[318].setConections(10011001); myFirstBox[318].setConections(10011001);
myFirstBox[319].setConections(01010110); myFirstBox[319].setConections(01010110);
myFirstBox[320].setConections(10100000); myFirstBox[320].setConections(10100000);
myFirstBox[321].setConections(10100101); myFirstBox[321].setConections(10100101);
myFirstBox[322].setConections(00010101); myFirstBox[322].setConections(00010101);
myFirstBox[323].setConections(01010110); myFirstBox[323].setConections(01010110);
myFirstBox[324].setConections(01101010); myFirstBox[324].setConections(01101010);
myFirstBox[325].setConections(10010110); myFirstBox[325].setConections(10010110);
myFirstBox[326].setConections(00001001); myFirstBox[326].setConections(00001001);
myFirstBox[327].setConections(10011010); myFirstBox[327].setConections(10011010);
myFirstBox[328].setConections(10101010); myFirstBox[328].setConections(10101010);
myFirstBox[329].setConections(01100101); myFirstBox[329].setConections(01100101);
myFirstBox[330].setConections(01011010); myFirstBox[330].setConections(01011010);
myFirstBox[331].setConections(01101010); myFirstBox[331].setConections(01101010);
myFirstBox[332].setConections(10100101); myFirstBox[332].setConections(10100101);
myFirstBox[333].setConections(10100101); myFirstBox[333].setConections(10100101);
myFirstBox[334].setConections(01011000); myFirstBox[334].setConections(01011000);
myFirstBox[335].setConections(01010110); myFirstBox[335].setConections(01010110);
myFirstBox[336].setConections(00100110); myFirstBox[336].setConections(00100110);
myFirstBox[337].setConections(01101010); myFirstBox[337].setConections(01101010);
myFirstBox[338].setConections(01101010); myFirstBox[338].setConections(01101010);
myFirstBox[339].setConections(10010110); myFirstBox[339].setConections(10010110);
myFirstBox[340].setConections(10101010); myFirstBox[340].setConections(10101010);
myFirstBox[341].setConections(01100110); myFirstBox[341].setConections(01100110);
myFirstBox[342].setConections(10011000); myFirstBox[342].setConections(10011000);
myFirstBox[343].setConections(10101010); myFirstBox[343].setConections(10101010);
myFirstBox[344].setConections(01011001); myFirstBox[344].setConections(01011001);
myFirstBox[345].setConections(01101001); myFirstBox[345].setConections(01101001);
myFirstBox[346].setConections(10010101); myFirstBox[346].setConections(10010101);
myFirstBox[347].setConections(10101010); myFirstBox[347].setConections(10101010);
myFirstBox[348].setConections(10011001); myFirstBox[348].setConections(10011001);
myFirstBox[349].setConections(01101001); myFirstBox[349].setConections(01101001);
myFirstBox[350].setConections(01010110); myFirstBox[350].setConections(01010110);
myFirstBox[351].setConections(10000110); myFirstBox[351].setConections(10000110);
myFirstBox[352].setConections(10010110); myFirstBox[352].setConections(10010110);
myFirstBox[353].setConections(10011010); myFirstBox[353].setConections(10011010);
myFirstBox[354].setConections(01010110); myFirstBox[354].setConections(01010110);
myFirstBox[355].setConections(10010010); myFirstBox[355].setConections(10010010);
myFirstBox[356].setConections(10100110); myFirstBox[356].setConections(10100110);
myFirstBox[357].setConections(10101001); myFirstBox[357].setConections(10101001);
myFirstBox[358].setConections(01011001); myFirstBox[358].setConections(01011001);
myFirstBox[359].setConections(01010000); myFirstBox[359].setConections(01010000);
myFirstBox[360].setConections(10011001); myFirstBox[360].setConections(10011001);
myFirstBox[361].setConections(01101001); myFirstBox[361].setConections(01101001);
myFirstBox[362].setConections(01100001); myFirstBox[362].setConections(01100001);
myFirstBox[363].setConections(10100110); myFirstBox[363].setConections(10100110);
myFirstBox[364].setConections(10100101); myFirstBox[364].setConections(10100101);
myFirstBox[365].setConections(01100101); myFirstBox[365].setConections(01100101);
myFirstBox[366].setConections(01001010); myFirstBox[366].setConections(01001010);
myFirstBox[367].setConections(10010110); myFirstBox[367].setConections(10010110);
myFirstBox[368].setConections(10010101); myFirstBox[368].setConections(10010101);
myFirstBox[369].setConections(10010100); myFirstBox[369].setConections(10010100);
myFirstBox[370].setConections(01010101); myFirstBox[370].setConections(01010101);
myFirstBox[371].setConections(01011000); myFirstBox[371].setConections(01011000);
myFirstBox[372].setConections(01100010); myFirstBox[372].setConections(01100010);
myFirstBox[373].setConections(10011001); myFirstBox[373].setConections(10011001);
myFirstBox[374].setConections(01100110); myFirstBox[374].setConections(01100110);
myFirstBox[375].setConections(10100101); myFirstBox[375].setConections(10100101);
myFirstBox[376].setConections(01000110); myFirstBox[376].setConections(01000110);
myFirstBox[377].setConections(01010101); myFirstBox[377].setConections(01010101);
myFirstBox[378].setConections(01100110); myFirstBox[378].setConections(01100110);
myFirstBox[379].setConections(10100110); myFirstBox[379].setConections(10100110);
myFirstBox[380].setConections(00100110); myFirstBox[380].setConections(00100110);
myFirstBox[381].setConections(01101001); myFirstBox[381].setConections(01101001);
myFirstBox[382].setConections(01100101); myFirstBox[382].setConections(01100101);
myFirstBox[383].setConections(10010101); myFirstBox[383].setConections(10010101);
myFirstBox[384].setConections(01101001); myFirstBox[384].setConections(01101001);
myFirstBox[385].setConections(10010110); myFirstBox[385].setConections(10010110);
myFirstBox[386].setConections(10010101); myFirstBox[386].setConections(10010101);
myFirstBox[387].setConections(10101001); myFirstBox[387].setConections(10101001);
myFirstBox[388].setConections(10011001); myFirstBox[388].setConections(10011001);
myFirstBox[389].setConections(01010110); myFirstBox[389].setConections(01010110);
myFirstBox[390].setConections(10100010); myFirstBox[390].setConections(10100010);
myFirstBox[391].setConections(10101001); myFirstBox[391].setConections(10101001);
myFirstBox[392].setConections(01101010); myFirstBox[392].setConections(01101010);
myFirstBox[393].setConections(10101010); myFirstBox[393].setConections(10101010);
myFirstBox[394].setConections(01100110); myFirstBox[394].setConections(01100110);
myFirstBox[395].setConections(01010101); myFirstBox[395].setConections(01010101);
myFirstBox[396].setConections(01101001); myFirstBox[396].setConections(01101001);
myFirstBox[397].setConections(10010101); myFirstBox[397].setConections(10010101);
myFirstBox[398].setConections(10100110); myFirstBox[398].setConections(10100110);
myFirstBox[399].setConections(01101010); myFirstBox[399].setConections(01101010);

View File

@ -1,34 +1,34 @@
Übergangstruktur Übergangstruktur
next() next()
{ {
calculate best next move out of information in log calculate best next move out of information in log
solve(with m and n or a puzzlepiece from box) solve(with m and n or a puzzlepiece from box)
} }
solve() solve()
{ {
solve algorithm solve algorithm
if(no solution) backtrack! if(no solution) backtrack!
if(multiple solutions) set multiple solutions into log...setsolution(); if(multiple solutions) set multiple solutions into log...setsolution();
if(one solution) set solution into log...setsolution(); if(one solution) set solution into log...setsolution();
return{no solution, multiple solutions, one solution} return{no solution, multiple solutions, one solution}
} }
setsolution() setsolution()
{ {
set pointer(s) in log set pointer(s) in log
set pointer to log into matrix set pointer to log into matrix
} }
backtrack() backtrack()
{ {
go into log, remove last piece go into log, remove last piece
goes back to next() goes back to next()
} }

View File

@ -1,375 +1,375 @@
//Raphael Maenle - 11.11.2017 //Raphael Maenle - 11.11.2017
#include <iostream> #include <iostream>
#include <bitset> #include <bitset>
#include <cstdlib> #include <cstdlib>
#include <time.h> #include <time.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
using namespace std; using namespace std;
class PuzzlePiece class PuzzlePiece
{ {
public: public:
unsigned char Ringbuffer; unsigned char Ringbuffer;
PuzzlePiece(unsigned int flag = 0) PuzzlePiece(unsigned int flag = 0)
{ {
shifts=0; shifts=0;
boxidentifier=-1; boxidentifier=-1;
switch(flag) switch(flag)
{ {
case 0: case 0:
Ringbuffer=0b00000000; Ringbuffer=0b00000000;
break; break;
case 1: case 1:
Ringbuffer=0b11111111; Ringbuffer=0b11111111;
break; break;
case 3: case 3:
randomCenterPiece(); randomCenterPiece();
break; break;
} }
} }
void Shift(unsigned int moves) void Shift(unsigned int moves)
{ {
//Shift ringbuffer to the right n number of times //Shift ringbuffer to the right n number of times
shifts = (shifts+moves)%4; shifts = (shifts+moves)%4;
Ringbuffer = ((Ringbuffer >> (moves*2)) | (Ringbuffer << sizeof(unsigned char)*8 - (moves*2))); Ringbuffer = ((Ringbuffer >> (moves*2)) | (Ringbuffer << sizeof(unsigned char)*8 - (moves*2)));
} }
void printPiece() void printPiece()
{ {
cout << bitset<sizeof(unsigned char)*8> (Ringbuffer); cout << bitset<sizeof(unsigned char)*8> (Ringbuffer);
} }
//makes piece to random center piece //makes piece to random center piece
void randomCenterPiece() void randomCenterPiece()
{ {
this->Ringbuffer= 0b00000000; this->Ringbuffer= 0b00000000;
if(rand()%2) if(rand()%2)
this->Ringbuffer |= 0b01000000; this->Ringbuffer |= 0b01000000;
else else
this->Ringbuffer |= 0b10000000; this->Ringbuffer |= 0b10000000;
if(rand()%2) if(rand()%2)
this->Ringbuffer |= 0b00010000; this->Ringbuffer |= 0b00010000;
else else
this->Ringbuffer |= 0b00100000; this->Ringbuffer |= 0b00100000;
if(rand()%2) if(rand()%2)
this->Ringbuffer |= 0b00000100; this->Ringbuffer |= 0b00000100;
else else
this->Ringbuffer |= 0b00001000; this->Ringbuffer |= 0b00001000;
if(rand()%2) if(rand()%2)
this->Ringbuffer |= 0b00000001; this->Ringbuffer |= 0b00000001;
else else
this->Ringbuffer |= 0b00000010; this->Ringbuffer |= 0b00000010;
} }
void assignIdentifier() void assignIdentifier()
{ {
identifier = idcount; identifier = idcount;
idcount++; idcount++;
} }
unsigned int getIdentifier() unsigned int getIdentifier()
{ {
return identifier; return identifier;
} }
void setBoxIdentifier(int new_boxid) void setBoxIdentifier(int new_boxid)
{ {
boxidentifier = new_boxid; boxidentifier = new_boxid;
} }
int getBoxIdentifier() int getBoxIdentifier()
{ {
return boxidentifier; return boxidentifier;
} }
private: private:
unsigned int shifts; unsigned int shifts;
unsigned int identifier; unsigned int identifier;
int boxidentifier; int boxidentifier;
static unsigned int idcount; static unsigned int idcount;
}; };
unsigned int PuzzlePiece::idcount(0); unsigned int PuzzlePiece::idcount(0);
//saves a matrix cluster of puzzlepieces //saves a matrix cluster of puzzlepieces
class Puzzle class Puzzle
{ {
public: public:
Puzzle(uint m = 7, uint n = 4): col(m), row(n) Puzzle(uint m = 7, uint n = 4): col(m), row(n)
{ {
Matrix = new PuzzlePiece* [n+2]; Matrix = new PuzzlePiece* [n+2];
//Box = new PuzzlePiece[n*m]; //Box = new PuzzlePiece[n*m];
for(int i = 0;i<n+2;i++) for(int i = 0;i<n+2;i++)
{ {
Matrix[i] = new PuzzlePiece[m+2]; Matrix[i] = new PuzzlePiece[m+2];
for(int j = 0;j<m+2;j++) for(int j = 0;j<m+2;j++)
{ {
if(i==0 || j==0 || i==n+1 || j==m+1) if(i==0 || j==0 || i==n+1 || j==m+1)
{ {
Matrix[i][j] = PuzzlePiece(0); Matrix[i][j] = PuzzlePiece(0);
} }
else else
{ {
Matrix[i][j] = PuzzlePiece(1); Matrix[i][j] = PuzzlePiece(1);
} }
/*else /*else
Matrix[i][j] = PuzzlePiece(1);*/ Matrix[i][j] = PuzzlePiece(1);*/
} }
} }
} }
//this adds new piece end excludes the 0 bounds around the area //this adds new piece end excludes the 0 bounds around the area
bool setPiece(uint m,uint n,PuzzlePiece newPiece) bool setPiece(uint m,uint n,PuzzlePiece newPiece)
{ {
if(this->PlaceOfPartGood(m,n,newPiece)) if(this->PlaceOfPartGood(m,n,newPiece))
{ {
Matrix[n+1][m+1] = newPiece; Matrix[n+1][m+1] = newPiece;
return 1; return 1;
} }
return 0; return 0;
} }
bool removePiece(uint m,uint n) bool removePiece(uint m,uint n)
{ {
Matrix[n+1][m+1] = 0b11111111; Matrix[n+1][m+1] = 0b11111111;
return 1; return 1;
} }
PuzzlePiece getPiece(uint m,uint n) PuzzlePiece getPiece(uint m,uint n)
{ {
return Matrix[n+1][m+1]; return Matrix[n+1][m+1];
} }
PuzzlePiece sudogetPiece(uint m,uint n) PuzzlePiece sudogetPiece(uint m,uint n)
{ {
return Matrix[n][m]; return Matrix[n][m];
} }
//check if place of the part in the matrix is correct //check if place of the part in the matrix is correct
bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart); bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart);
bool testRotationPiece(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 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); unsigned int putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox);
void printPuzzle(); void printPuzzle();
uint getCols() uint getCols()
{ {
return col; return col;
} }
uint getRows() uint getRows()
{ {
return row; return row;
} }
//creates a random puzzle of size m columns, n rows //creates a random puzzle of size m columns, n rows
void createRandomPuzzle(); void createRandomPuzzle();
//shuffles Box; //shuffles Box;
vector<PuzzlePiece> Shuffle(); vector<PuzzlePiece> Shuffle();
//prints box //prints box
void printBox(); void printBox();
private: private:
uint row; uint row;
uint col; uint col;
PuzzlePiece** Matrix; PuzzlePiece** Matrix;
vector<PuzzlePiece> Box; vector<PuzzlePiece> Box;
void sudosetPiece(uint m,uint n,PuzzlePiece newPiece) void sudosetPiece(uint m,uint n,PuzzlePiece newPiece)
{ {
if(this->PlaceOfPartGood(m,n,newPiece)) if(this->PlaceOfPartGood(m,n,newPiece))
Matrix[n][m] = newPiece; Matrix[n][m] = newPiece;
} }
void sudoprintPuzzle() void sudoprintPuzzle()
{ {
for(int i=0;i<row+2;i++) for(int i=0;i<row+2;i++)
{ {
for(int j=0;j<col+2;j++) for(int j=0;j<col+2;j++)
{ {
Matrix[i][j].printPiece(); Matrix[i][j].printPiece();
cout << " "; cout << " ";
} }
cout << endl; cout << endl;
} }
} }
}; };
//checks if piece fits into m n position in matrix; //checks if piece fits into m n position in matrix;
bool Puzzle::PlaceOfPartGood(unsigned int m,unsigned int n, PuzzlePiece& myPart) bool Puzzle::PlaceOfPartGood(unsigned int m,unsigned int n, PuzzlePiece& myPart)
{ {
PuzzlePiece tmpPuzzlePiece = myPart; PuzzlePiece tmpPuzzlePiece = myPart;
PuzzlePiece negativePart(0); PuzzlePiece negativePart(0);
negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m,n+1).Ringbuffer & 0b11000000); negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m,n+1).Ringbuffer & 0b11000000);
negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m-1,n).Ringbuffer & 0b00110000); negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m-1,n).Ringbuffer & 0b00110000);
negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m,n-1).Ringbuffer & 0b00001100); negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m,n-1).Ringbuffer & 0b00001100);
negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m+1,n).Ringbuffer & 0b00000011); negativePart.Ringbuffer = negativePart.Ringbuffer | (getPiece(m+1,n).Ringbuffer & 0b00000011);
negativePart.Shift(2); negativePart.Shift(2);
/* cout << "negativePart: "; /* cout << "negativePart: ";
negativePart.printPiece(); negativePart.printPiece();
unsigned char topPart = ((negativePart.Ringbuffer & 0b11000000) ^ (tmpPuzzlePiece.Ringbuffer & 0b11000000)); unsigned char topPart = ((negativePart.Ringbuffer & 0b11000000) ^ (tmpPuzzlePiece.Ringbuffer & 0b11000000));
cout << "topPart: " << bitset<sizeof(unsigned char)*8> (topPart) << endl; cout << "topPart: " << bitset<sizeof(unsigned char)*8> (topPart) << endl;
unsigned char rightPart = ((negativePart.Ringbuffer & 0b00110000) ^ (tmpPuzzlePiece.Ringbuffer & 0b00110000)); unsigned char rightPart = ((negativePart.Ringbuffer & 0b00110000) ^ (tmpPuzzlePiece.Ringbuffer & 0b00110000));
cout << "rightPart: " << bitset<sizeof(unsigned char)*8> (rightPart) << endl; cout << "rightPart: " << bitset<sizeof(unsigned char)*8> (rightPart) << endl;
unsigned char lowPart = ((negativePart.Ringbuffer & 0b00001100) ^ (tmpPuzzlePiece.Ringbuffer & 0b00001100)); unsigned char lowPart = ((negativePart.Ringbuffer & 0b00001100) ^ (tmpPuzzlePiece.Ringbuffer & 0b00001100));
cout << "lowPart: " << bitset<sizeof(unsigned char)*8> (lowPart) << endl; cout << "lowPart: " << bitset<sizeof(unsigned char)*8> (lowPart) << endl;
unsigned char leftPart = ((negativePart.Ringbuffer & 0b00000011) ^ (tmpPuzzlePiece.Ringbuffer & 0b00000011)); unsigned char leftPart = ((negativePart.Ringbuffer & 0b00000011) ^ (tmpPuzzlePiece.Ringbuffer & 0b00000011));
cout << "leftPart: " << bitset<sizeof(unsigned char)*8> (leftPart) << endl; cout << "leftPart: " << bitset<sizeof(unsigned char)*8> (leftPart) << endl;
*/ */
if ( //simplify if ( //simplify
( ((((negativePart.Ringbuffer & 0b11000000) ^ (tmpPuzzlePiece.Ringbuffer & 0b11000000)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b11000000) != 0b00000000) ( ((((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) == 0b11000000) || ((tmpPuzzlePiece.Ringbuffer & 0b11000000) == 0b11000000)) && (tmpPuzzlePiece.Ringbuffer & 0b11000000) != 0b00000000)
|| (((negativePart.Ringbuffer & 0b11000000) == 0b00000000) && ((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) ^ (tmpPuzzlePiece.Ringbuffer & 0b00110000)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b001100) != 0b00000000)
|| ((((negativePart.Ringbuffer & 0b00110000) == 0b00110000) || ((tmpPuzzlePiece.Ringbuffer & 0b00110000) == 0b00110000)) && (tmpPuzzlePiece.Ringbuffer & 0b00110000) != 0b00000000) || ((((negativePart.Ringbuffer & 0b00110000) == 0b00110000) || ((tmpPuzzlePiece.Ringbuffer & 0b00110000) == 0b00110000)) && (tmpPuzzlePiece.Ringbuffer & 0b00110000) != 0b00000000)
|| (((negativePart.Ringbuffer & 0b00110000) == 0b00000000) && ((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) ^ (tmpPuzzlePiece.Ringbuffer & 0b00001100)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b00001100) != 0b00000000)
|| ((((negativePart.Ringbuffer & 0b00001100) == 0b00001100) || ((tmpPuzzlePiece.Ringbuffer & 0b00001100) == 0b00001100)) && (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 & 0b00001100) == 0b00000000) && ((tmpPuzzlePiece.Ringbuffer & 0b00001100) == 0b00000000)) )
&& &&
( ((((negativePart.Ringbuffer & 0b00000011) ^ (tmpPuzzlePiece.Ringbuffer & 0b00000011)) != 0b00000000) && (tmpPuzzlePiece.Ringbuffer & 0b00000011) != 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) == 0b00000011) || ((tmpPuzzlePiece.Ringbuffer & 0b00000011) == 0b00000011)) && (tmpPuzzlePiece.Ringbuffer & 0b00000011) != 0b00000000)
|| (((negativePart.Ringbuffer & 0b00000011) == 0b00000000) && ((tmpPuzzlePiece.Ringbuffer & 0b00000011) == 0b00000000)) ) || (((negativePart.Ringbuffer & 0b00000011) == 0b00000000) && ((tmpPuzzlePiece.Ringbuffer & 0b00000011) == 0b00000000)) )
) )
return 1; return 1;
return 0; return 0;
} }
void Puzzle::printPuzzle() void Puzzle::printPuzzle()
{ {
for(int i=1;i<row+1;i++) for(int i=1;i<row+1;i++)
{ {
for(int j=1;j<col+1;j++) for(int j=1;j<col+1;j++)
{ {
Matrix[i][j].printPiece(); Matrix[i][j].printPiece();
cout << " "; cout << " ";
} }
cout << endl; cout << endl;
} }
} }
void Puzzle::createRandomPuzzle() void Puzzle::createRandomPuzzle()
{ {
PuzzlePiece temporaryRandomPiece(0); PuzzlePiece temporaryRandomPiece(0);
for(int i=0;i<getRows();i++) for(int i=0;i<getRows();i++)
{ {
for(int j = 0; j < getCols();) for(int j = 0; j < getCols();)
{ {
//create random piece, set edges according to position and check if piece is good //create random piece, set edges according to position and check if piece is good
temporaryRandomPiece.randomCenterPiece(); temporaryRandomPiece.randomCenterPiece();
if(i==0) if(i==0)
temporaryRandomPiece.Ringbuffer &= 0b00111111; temporaryRandomPiece.Ringbuffer &= 0b00111111;
if(i==getRows()-1) if(i==getRows()-1)
temporaryRandomPiece.Ringbuffer &= 0b11110011; temporaryRandomPiece.Ringbuffer &= 0b11110011;
if(j==0) if(j==0)
temporaryRandomPiece.Ringbuffer &= 0b11111100; temporaryRandomPiece.Ringbuffer &= 0b11111100;
if(j==getCols()-1) if(j==getCols()-1)
temporaryRandomPiece.Ringbuffer &= 0b11001111; temporaryRandomPiece.Ringbuffer &= 0b11001111;
if(PlaceOfPartGood(j,i,temporaryRandomPiece)) if(PlaceOfPartGood(j,i,temporaryRandomPiece))
{ {
temporaryRandomPiece.assignIdentifier(); temporaryRandomPiece.assignIdentifier();
setPiece(j,i,temporaryRandomPiece); setPiece(j,i,temporaryRandomPiece);
j++; j++;
Box.push_back(temporaryRandomPiece); Box.push_back(temporaryRandomPiece);
} }
} }
} }
} }
void Puzzle::printBox() void Puzzle::printBox()
{ {
Shuffle(); Shuffle();
for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++) for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++)
{ {
(*i).printPiece(); (*i).printPiece();
cout << ' '; cout << ' ';
} }
cout << endl; cout << endl;
} }
vector<PuzzlePiece> Puzzle::Shuffle() vector<PuzzlePiece> Puzzle::Shuffle()
{ {
random_shuffle(Box.begin(),Box.end()); random_shuffle(Box.begin(),Box.end());
return Box; return Box;
} }
bool Puzzle::testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart) bool Puzzle::testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart)
{ {
for(int rotation=0; rotation < 4; rotation++) for(int rotation=0; rotation < 4; rotation++)
{ {
myPart.Shift(1); myPart.Shift(1);
myPart.printPiece(); myPart.printPiece();
cout << endl; cout << endl;
if(PlaceOfPartGood(m,n, myPart)) if(PlaceOfPartGood(m,n, myPart))
{ {
return 1; return 1;
} }
} }
return 0; return 0;
} }
//tries all pieces in box from separator to end and places fitting into matrix. removes fitting piece //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 //use separator if you have to retract to a position
unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox, unsigned int separator) unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox, unsigned int separator)
{ {
for(int i=separator; i<myBox.size();i++) for(int i=separator; i<myBox.size();i++)
{ {
if(testRotationPiece(m,n,myBox[i])) if(testRotationPiece(m,n,myBox[i]))
{ {
setPiece(m,n,myBox[i]); setPiece(m,n,myBox[i]);
myBox.erase(myBox.begin()+i); myBox.erase(myBox.begin()+i);
return i; return i;
} }
} }
return -1; return -1;
} }
//insterts piece at position in box according to boxidentifier and removes piece from puzzle //insterts piece at position in box according to boxidentifier and removes piece from puzzle
//this returns the position the puzzle piece was put back in! not the boxidentifier of the piece. look that up in other function. //this returns the position the puzzle piece was put back in! not the boxidentifier of the piece. look that up in other function.
unsigned int Puzzle::putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox) unsigned int Puzzle::putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox)
{ {
for(int i = 0; i < myBox.size();i++) for(int i = 0; i < myBox.size();i++)
{ {
if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier()) if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier())
{ {
myBox.insert(myBox.begin()+i,getPiece(m,n)); myBox.insert(myBox.begin()+i,getPiece(m,n));
removePiece(m,n); removePiece(m,n);
return i; return i;
} }
} }
} }
vector<PuzzlePiece> createBox(uint m, uint n) vector<PuzzlePiece> createBox(uint m, uint n)
{ {
Puzzle myFirstPuzzle(m,n); Puzzle myFirstPuzzle(m,n);
myFirstPuzzle.createRandomPuzzle(); myFirstPuzzle.createRandomPuzzle();
return myFirstPuzzle.Shuffle(); return myFirstPuzzle.Shuffle();
} }

View File

@ -1,160 +1,160 @@
//Raphael Maenle - 11.11.2017 //Raphael Maenle - 11.11.2017
#include <iostream> #include <iostream>
#include <bitset> #include <bitset>
#include <cstdlib> #include <cstdlib>
#include <time.h> #include <time.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include "puzzle.h" #include "puzzle.h"
//#include "Solver.h" //#include "Solver.h"
using namespace std; using namespace std;
void numerateBox(vector<PuzzlePiece>& myBox); void numerateBox(vector<PuzzlePiece>& myBox);
Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector<PuzzlePiece>& myFirstBox); Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector<PuzzlePiece>& myFirstBox);
void retractOuterFirst(int& i, int& j, int cols, int rows, int perimiter); void retractOuterFirst(int& i, int& j, int cols, int rows, int perimiter);
int main() int main()
{ {
srand(time(0)); srand(time(0));
//Puzzle myFirstPuzzle(3,4); //Puzzle myFirstPuzzle(3,4);
int rows = 2, cols = 3; int rows = 2, cols = 3;
vector<PuzzlePiece> myFirstBox = createBox(cols, rows); vector<PuzzlePiece> myFirstBox = createBox(cols, rows);
numerateBox(myFirstBox); numerateBox(myFirstBox);
cout << "now in solve: " << endl << endl; cout << "now in solve: " << endl << endl;
solveOuterFirst(rows,cols,myFirstBox); solveOuterFirst(rows,cols,myFirstBox);
} }
//set box identifiers //set box identifiers
void numerateBox(vector<PuzzlePiece>& myBox) void numerateBox(vector<PuzzlePiece>& myBox)
{ {
for(int i = 0; i< myBox.size();i++) for(int i = 0; i< myBox.size();i++)
myBox[i].setBoxIdentifier(i); myBox[i].setBoxIdentifier(i);
return; return;
} }
//goes round and round puzzle and tries all pieces //goes round and round puzzle and tries all pieces
Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector<PuzzlePiece>& myFirstBox) Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector<PuzzlePiece>& myFirstBox)
{ {
int i = 0, j= 0, Boxsize = rows*cols, separator=0; int i = 0, j= 0, Boxsize = rows*cols, separator=0;
Puzzle myFirstPuzzle(cols, rows); Puzzle myFirstPuzzle(cols, rows);
//first Piece //first Piece
cout << "#0 i: " << i << ", j: " << j << endl; cout << "#0 i: " << i << ", j: " << j << endl;
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
cout << "error at first piece" << endl; cout << "error at first piece" << endl;
} }
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
/* /*
Boxsize--; Boxsize--;
//rotate through puzzle //rotate through puzzle
for(int perimiter = 0; perimiter <= (cols>rows?rows:cols)/2;) for(int perimiter = 0; perimiter <= (cols>rows?rows:cols)/2;)
{ {
cout << "perimiter: " << perimiter << endl; cout << "perimiter: " << perimiter << endl;
while(( i == 0+perimiter && j < cols-perimiter-1) && Boxsize) while(( i == 0+perimiter && j < cols-perimiter-1) && Boxsize)
{ {
j++; j++;
Boxsize--; Boxsize--;
cout << "#1 i: " << i << ", j: " << j << endl; cout << "#1 i: " << i << ", j: " << j << endl;
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
Boxsize++; Boxsize++;
break; break;
} }
else else
{ {
Boxsize--; Boxsize--;
} }
} }
while(( i < rows-perimiter-1 && j == cols-perimiter-1) && Boxsize) while(( i < rows-perimiter-1 && j == cols-perimiter-1) && Boxsize)
{ {
i++; i++;
Boxsize--; Boxsize--;
cout << "#2 i: " << i << ", j: " << j << endl; cout << "#2 i: " << i << ", j: " << j << endl;
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
Boxsize++; Boxsize++;
break; break;
} }
else else
{ {
Boxsize--; Boxsize--;
} }
} }
while(( i == rows-perimiter-1 && j > 0+perimiter) && Boxsize) while(( i == rows-perimiter-1 && j > 0+perimiter) && Boxsize)
{ {
j--; j--;
Boxsize--; Boxsize--;
cout << "#3 i: " << i << ", j: " << j << endl; cout << "#3 i: " << i << ", j: " << j << endl;
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
Boxsize++; Boxsize++;
break; break;
} }
else else
{ {
Boxsize--; Boxsize--;
} }
} }
while(( i > 0+perimiter+1 && j == 0+perimiter) && Boxsize) while(( i > 0+perimiter+1 && j == 0+perimiter) && Boxsize)
{ {
i--; i--;
cout << "#4 i: " << i << ", j: " << j << endl; cout << "#4 i: " << i << ", j: " << j << endl;
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
Boxsize++; Boxsize++;
break; break;
} }
else else
{ {
Boxsize--; Boxsize--;
perimiter++; perimiter++;
} }
} }
} }
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
*/ */
return myFirstPuzzle; return myFirstPuzzle;
} }
//move i and j to position before //move i and j to position before
void retractOuterFirst(int& i, int& j, int cols, int rows, int perimiter) void retractOuterFirst(int& i, int& j, int cols, int rows, int perimiter)
{ {
if(( i == 0+perimiter && j <= cols-perimiter-1)) if(( i == 0+perimiter && j <= cols-perimiter-1))
{ {
j--; j--;
} }
else if(( i <= rows-perimiter-1 && j == cols-perimiter-1)) else if(( i <= rows-perimiter-1 && j == cols-perimiter-1))
{ {
i--; i--;
} }
else if(( i == rows-perimiter-1 && j >= 0+perimiter)) else if(( i == rows-perimiter-1 && j >= 0+perimiter))
{ {
j++; j++;
} }
else if(( i >= 0+perimiter+1 && j == 0+perimiter)) else if(( i >= 0+perimiter+1 && j == 0+perimiter))
{ {
i++; i++;
} }
} }

View File

@ -1,305 +1,305 @@
//Raphael Maenle - 11.11.2017 //Raphael Maenle - 11.11.2017
#include <iostream> #include <iostream>
#include <bitset> #include <bitset>
#include <cstdlib> #include <cstdlib>
#include <time.h> #include <time.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#define debug #define debug
#include "puzzle.h" #include "puzzle.h"
#include "test_puzzle.h" #include "test_puzzle.h"
using namespace std; using namespace std;
Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector<PuzzlePiece>& myFirstBox); Puzzle solveOuterFirst( unsigned int rows, unsigned int cols, vector<PuzzlePiece>& myFirstBox);
void retractOuterFirst(int& i, int& j, int cols, int rows, int& perimiter); void retractOuterFirst(int& i, int& j, int cols, int rows, int& perimiter);
int main() int main()
{ {
srand(time(0)); srand(time(0));
vector<Part> part_array(NR_PARTS); vector<Part> part_array(NR_PARTS);
vector<Part *> corners_array(NR_CORNERS); vector<Part *> corners_array(NR_CORNERS);
vector<Part *> edges_array(NR_EDGES); vector<Part *> edges_array(NR_EDGES);
vector<Part *> inners_array(NR_INNERS); vector<Part *> inners_array(NR_INNERS);
//randomBox myPuzzle(cols,rows); //randomBox myPuzzle(cols,rows);
//myPuzzle.createRandomPuzzle(); //myPuzzle.createRandomPuzzle();
unsigned int rows=5, cols=5; unsigned int rows=5, cols=5;
//vector<PuzzlePiece> myFirstBox = createBox(cols, rows); //vector<PuzzlePiece> myFirstBox = createBox(cols, rows);
//create4040hardBox(myFirstBox); //create4040hardBox(myFirstBox);
/*myFirstBox[0].setConnections(0b01100010); /*myFirstBox[0].setConnections(0b01100010);
myFirstBox[1].setConnections(0b00010100); myFirstBox[1].setConnections(0b00010100);
myFirstBox[2].setConnections(0b00011010); myFirstBox[2].setConnections(0b00011010);
myFirstBox[3].setConnections(0b10000001); myFirstBox[3].setConnections(0b10000001);
myFirstBox[4].setConnections(0b00011000); myFirstBox[4].setConnections(0b00011000);
myFirstBox[5].setConnections(0b01100000);*/ myFirstBox[5].setConnections(0b01100000);*/
Puzzle myFirstPuzzle(3,4); Puzzle myFirstPuzzle(3,4);
PuzzlePiece myFirstPiece(1); PuzzlePiece myFirstPiece(1);
myFirstPiece.setConnections(0b00010100); myFirstPiece.setConnections(0b00010100);
if(myFirstPuzzle.PlaceOfPartGood(myFirstPiece)); if(myFirstPuzzle.PlaceOfPartGood(myFirstPiece));
cout << "good" << endl; cout << "good" << endl;
//printBox(myFirstBox); //printBox(myFirstBox);
cout << endl; cout << endl;
//Puzzle newPuzzle = solveOuterFirst(cols, rows, myFirstBox); //Puzzle newPuzzle = solveOuterFirst(cols, rows, myFirstBox);
return 0; return 0;
} }
//rotates in snail form clockwise around board and tries placing puzzle pieces. //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 //if no piece fits in position it tries next piece of the piece before
Puzzle solveOuterFirst( unsigned int cols, unsigned int rows, vector<PuzzlePiece>& myFirstBox) Puzzle solveOuterFirst( unsigned int cols, unsigned int rows, vector<PuzzlePiece>& myFirstBox)
{ {
int i = 0, j= 0, Boxsize = rows*cols, separator=0; int i = 0, j= 0, Boxsize = rows*cols, separator=0;
Puzzle myFirstPuzzle(cols, rows); Puzzle myFirstPuzzle(cols, rows);
//first Piece //first Piece
//rotate through puzzle //rotate through puzzle
int perimiter; int perimiter;
int numberofsolutions=0; int numberofsolutions=0;
int newPerimiter = 1; int newPerimiter = 1;
for(perimiter = 0; /*perimiter <= (cols>rows?rows:cols)/2;*/;) for(perimiter = 0; /*perimiter <= (cols>rows?rows:cols)/2;*/;)
{ {
if(Boxsize) if(Boxsize)
{ {
#ifdef debug #ifdef debug
cout << "perimiter: " << perimiter << endl; cout << "perimiter: " << perimiter << endl;
#endif #endif
} }
else else
{ {
break; break;
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
Boxsize++; Boxsize++;
separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox);
numberofsolutions++; numberofsolutions++;
} }
if((i==rows/2 && j==cols/2 )&& cols==rows) if((i==rows/2 && j==cols/2 )&& cols==rows)
{ {
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
Boxsize++; Boxsize++;
separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox);
} }
else else
{ {
break; break;
separator=0; separator=0;
Boxsize--; Boxsize--;
} }
} }
if((i==perimiter+1 && j==perimiter)) if((i==perimiter+1 && j==perimiter))
{ {
#ifdef debug #ifdef debug
cout << "#0 i: " << i << ", j: " << j << endl; cout << "#0 i: " << i << ", j: " << j << endl;
#endif #endif
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
Boxsize++; Boxsize++;
separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox);
#ifdef debug #ifdef debug
cout << "New Box: "; cout << "New Box: ";
printBox(myFirstBox); printBox(myFirstBox);
cout << endl; cout << endl;
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
cout << "Boxsize: " << Boxsize << endl; cout << "Boxsize: " << Boxsize << endl;
cout << "separator: " << separator << endl; cout << "separator: " << separator << endl;
#endif #endif
} }
else else
{ {
perimiter=newPerimiter; perimiter=newPerimiter;
newPerimiter++; newPerimiter++;
j++; j++;
separator=0; separator=0;
Boxsize--; Boxsize--;
#ifdef debug #ifdef debug
cout << " Perimiter: " << perimiter << endl; cout << " Perimiter: " << perimiter << endl;
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
#endif #endif
} }
} }
else else
{ {
//cout << "general information i: " << i << ", j: " << j << endl; //cout << "general information i: " << i << ", j: " << j << endl;
while(( i == 0+perimiter && j < cols-perimiter-1) && Boxsize) while(( i == 0+perimiter && j < cols-perimiter-1) && Boxsize)
{ {
#ifdef debug #ifdef debug
cout << "#1 i: " << i << ", j: " << j << endl; cout << "#1 i: " << i << ", j: " << j << endl;
#endif #endif
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox);
Boxsize++; Boxsize++;
#ifdef debug #ifdef debug
cout << "New Box: "; cout << "New Box: ";
printBox(myFirstBox); printBox(myFirstBox);
cout << endl; cout << endl;
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
cout << "Boxsize: " << Boxsize << endl; cout << "Boxsize: " << Boxsize << endl;
cout << "separator: " << separator << endl; cout << "separator: " << separator << endl;
#endif #endif
break; break;
} }
else else
{ {
j++; j++;
separator=0; separator=0;
Boxsize--; Boxsize--;
#ifdef debug #ifdef debug
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
#endif #endif
} }
} }
while(( i < rows-perimiter-1 && j == cols-perimiter-1) && Boxsize) while(( i < rows-perimiter-1 && j == cols-perimiter-1) && Boxsize)
{ {
#ifdef debug #ifdef debug
cout << "#2 i: " << i << ", j: " << j << endl; cout << "#2 i: " << i << ", j: " << j << endl;
#endif #endif
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox);
Boxsize++; Boxsize++;
#ifdef debug #ifdef debug
cout << "New Box: "; cout << "New Box: ";
printBox(myFirstBox); printBox(myFirstBox);
cout << endl; cout << endl;
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
cout << "Boxsize: " << Boxsize << endl; cout << "Boxsize: " << Boxsize << endl;
cout << "separator: " << separator << endl; cout << "separator: " << separator << endl;
#endif #endif
break; break;
} }
else else
{ {
i++; i++;
separator=0; separator=0;
Boxsize--; Boxsize--;
#ifdef debug #ifdef debug
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
#endif #endif
} }
} }
while(( i == rows-perimiter-1 && j > 0+perimiter) && Boxsize) while(( i == rows-perimiter-1 && j > 0+perimiter) && Boxsize)
{ {
#ifdef debug #ifdef debug
cout << "#3 i: " << i << ", j: " << j << endl; cout << "#3 i: " << i << ", j: " << j << endl;
#endif #endif
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox);
Boxsize++; Boxsize++;
#ifdef debug #ifdef debug
cout << "New Box: "; cout << "New Box: ";
printBox(myFirstBox); printBox(myFirstBox);
cout << endl; cout << endl;
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
cout << "Boxsize: " << Boxsize << endl; cout << "Boxsize: " << Boxsize << endl;
cout << "separator: " << separator << endl; cout << "separator: " << separator << endl;
#endif #endif
break; break;
} }
else else
{ {
j--; j--;
separator=0; separator=0;
Boxsize--; Boxsize--;
#ifdef debug #ifdef debug
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
#endif #endif
} }
} }
while(( i > 0+perimiter+1 && j == 0+perimiter) && Boxsize) while(( i > 0+perimiter+1 && j == 0+perimiter) && Boxsize)
{ {
#ifdef debug #ifdef debug
cout << "#4 i: " << i << ", j: " << j << endl; cout << "#4 i: " << i << ", j: " << j << endl;
#endif #endif
if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1) if(myFirstPuzzle.tryAllPieces(j, i, myFirstBox,separator) == -1)
{ {
retractOuterFirst(i,j,cols,rows,perimiter); retractOuterFirst(i,j,cols,rows,perimiter);
separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox); separator = myFirstPuzzle.putBackIntoBox(j, i, myFirstBox);
Boxsize++; Boxsize++;
#ifdef debug #ifdef debug
cout << "New Box: "; cout << "New Box: ";
printBox(myFirstBox); printBox(myFirstBox);
cout << endl; cout << endl;
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
cout << "Boxsize: " << Boxsize << endl; cout << "Boxsize: " << Boxsize << endl;
cout << "separator: " << separator << endl; cout << "separator: " << separator << endl;
#endif #endif
break; break;
} }
else else
{ {
i--; i--;
separator=0; separator=0;
Boxsize--; Boxsize--;
#ifdef debug #ifdef debug
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
#endif #endif
} }
} }
} }
} }
myFirstPuzzle.printPuzzle(); myFirstPuzzle.printPuzzle();
return myFirstPuzzle; return myFirstPuzzle;
} }
//move i and j to position before //move i and j to position before
void retractOuterFirst(int& i, int& j, int cols, int rows, int& perimiter) void retractOuterFirst(int& i, int& j, int cols, int rows, int& perimiter)
{ {
#ifdef debug #ifdef debug
cout << "retracting: i=" << i << " j=" << j << endl; cout << "retracting: i=" << i << " j=" << j << endl;
#endif #endif
if(( i == 0+perimiter && j <= cols-perimiter-1)) if(( i == 0+perimiter && j <= cols-perimiter-1))
{ {
j--; j--;
} }
else if(( i <= rows-perimiter-1 && j == cols-perimiter-1)) else if(( i <= rows-perimiter-1 && j == cols-perimiter-1))
{ {
i--; i--;
} }
else if(( i == rows-perimiter-1 && j >= 0+perimiter)) else if(( i == rows-perimiter-1 && j >= 0+perimiter))
{ {
j++; j++;
} }
else if(( i >= 0+perimiter+1 && j == 0+perimiter)) else if(( i >= 0+perimiter+1 && j == 0+perimiter))
{ {
i++; i++;
} }
#ifdef debug #ifdef debug
cout << "to: i=" << i << " j=" << j << endl; cout << "to: i=" << i << " j=" << j << endl;
#endif #endif
} }

View File

@ -1,469 +1,469 @@
#include <stdint.h> #include <stdint.h>
#define NR_PARTS 1008 #define NR_PARTS 1008
#define NR_CORNERS 4 #define NR_CORNERS 4
#define NR_EDGES 120 #define NR_EDGES 120
#define NR_INNERS 884 #define NR_INNERS 884
using namespace std; using namespace std;
//part from group header file //part from group header file
class Part class Part
{ {
public: public:
Part(): connections(0){} Part(): connections(0){}
~Part() {} ~Part() {}
uint8_t getConnections() const uint8_t getConnections() const
{ {
return connections; return connections;
} }
void setConnections(uint8_t newconnections) void setConnections(uint8_t newconnections)
{ {
connections = newconnections; connections = newconnections;
} }
private: private:
uint8_t connections; uint8_t connections;
}; };
//puzzlepiece extens part with essential identifiers and functions //puzzlepiece extens part with essential identifiers and functions
class PuzzlePiece: public Part class PuzzlePiece: public Part
{ {
public: public:
PuzzlePiece(unsigned int flag = 0) PuzzlePiece(unsigned int flag = 0)
{ {
shifts=0; shifts=0;
boxidentifier=-1; boxidentifier=-1;
switch(flag) switch(flag)
{ {
case 0: case 0:
setConnections(0b00000000); setConnections(0b00000000);
break; break;
case 1: case 1:
setConnections(0b11111111); setConnections(0b11111111);
break; break;
case 3: case 3:
randomCenterPiece(); randomCenterPiece();
break; break;
} }
} }
void shift(unsigned int moves); void shift(unsigned int moves);
void randomCenterPiece(); void randomCenterPiece();
void printPiece() { cout << bitset<sizeof(unsigned char)*8> (getConnections()); } void printPiece() { cout << bitset<sizeof(unsigned char)*8> (getConnections()); }
void setBoxIdentifier(int new_boxid) { boxidentifier = new_boxid; } void setBoxIdentifier(int new_boxid) { boxidentifier = new_boxid; }
int getBoxIdentifier() { return boxidentifier; } int getBoxIdentifier() { return boxidentifier; }
void assignIdentifier() { identifier = idcount;idcount++; } void assignIdentifier() { identifier = idcount;idcount++; }
unsigned int getIdentifier() { return identifier;} unsigned int getIdentifier() { return identifier;}
private: private:
unsigned int shifts; unsigned int shifts;
unsigned int boxidentifier; unsigned int boxidentifier;
unsigned int identifier; unsigned int identifier;
static unsigned int idcount; static unsigned int idcount;
}; };
unsigned int PuzzlePiece::idcount(0); unsigned int PuzzlePiece::idcount(0);
class Puzzle class Puzzle
{ {
friend class randomBox; friend class randomBox;
public: public:
//constructor creates matrix with 00 outside and 11 inside //constructor creates matrix with 00 outside and 11 inside
Puzzle(uint m = 7, uint n = 4): col(m), row(n) Puzzle(uint m = 7, uint n = 4): col(m), row(n)
{ {
Matrix = new PuzzlePiece* [n+2]; Matrix = new PuzzlePiece* [n+2];
for(int i = 0;i<n+2;i++) for(int i = 0;i<n+2;i++)
{ {
Matrix[i] = new PuzzlePiece[m+2]; Matrix[i] = new PuzzlePiece[m+2];
for(int j = 0;j<m+2;j++) for(int j = 0;j<m+2;j++)
{ {
if(i==0 || j==0 || i==n+1 || j==m+1) if(i==0 || j==0 || i==n+1 || j==m+1)
{ {
Matrix[i][j] = PuzzlePiece(0); Matrix[i][j] = PuzzlePiece(0);
} }
else else
{ {
Matrix[i][j] = PuzzlePiece(1); Matrix[i][j] = PuzzlePiece(1);
} }
} }
} }
} }
bool setPiece(uint m,uint n,PuzzlePiece newPiece) bool setPiece(uint m,uint n,PuzzlePiece newPiece)
{ {
if(PlaceOfPartGood(m,n,newPiece)) if(PlaceOfPartGood(m,n,newPiece))
{ {
Matrix[n+1][m+1] = newPiece; Matrix[n+1][m+1] = newPiece;
return 1; return 1;
} }
return 0; return 0;
} }
//removes piece and instead puts undefined piece //removes piece and instead puts undefined piece
bool removePiece(uint m,uint n) bool removePiece(uint m,uint n)
{ {
Matrix[n+1][m+1].setConnections(0b11111111); Matrix[n+1][m+1].setConnections(0b11111111);
return 1; return 1;
} }
//getter //getter
PuzzlePiece getPiece(uint m,uint n) { return Matrix[n+1][m+1]; } PuzzlePiece getPiece(uint m,uint n) { return Matrix[n+1][m+1]; }
uint getCols(){ return col; } uint getCols(){ return col; }
uint getRows(){ return row; } uint getRows(){ return row; }
//functtion definitions //functtion definitions
void printPuzzle(); void printPuzzle();
bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart); bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart);
bool PlaceOfPart2Good(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); 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 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); unsigned int putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox);
private: private:
uint row; uint row;
uint col; uint col;
PuzzlePiece** Matrix; PuzzlePiece** Matrix;
}; };
//use this for random puzzle creation //use this for random puzzle creation
class randomBox: public Puzzle class randomBox: public Puzzle
{ {
public: public:
randomBox(unsigned int m, unsigned int n) : Puzzle(m,n) {} //passed m n to puzzle constructor randomBox(unsigned int m, unsigned int n) : Puzzle(m,n) {} //passed m n to puzzle constructor
void createRandomPuzzle(); void createRandomPuzzle();
vector<PuzzlePiece> shuffle(); vector<PuzzlePiece> shuffle();
void printBox(); void printBox();
private: private:
vector<PuzzlePiece> Box; vector<PuzzlePiece> Box;
}; };
//functiondefinitions //functiondefinitions
void printBox(vector<PuzzlePiece> myBox); void printBox(vector<PuzzlePiece> myBox);
vector<PuzzlePiece> createBox(uint m, uint n); vector<PuzzlePiece> createBox(uint m, uint n);
void numerateBox(vector<PuzzlePiece>& myBox); void numerateBox(vector<PuzzlePiece>& myBox);
//functions //functions
//shifts puzzle piece one to the right //shifts puzzle piece one to the right
void PuzzlePiece::shift(unsigned int moves) void PuzzlePiece::shift(unsigned int moves)
{ {
shifts = (shifts+moves)%4; shifts = (shifts+moves)%4;
setConnections(((getConnections() >> (moves*2)) | (getConnections() << sizeof(unsigned char)*8 - (moves*2)))); setConnections(((getConnections() >> (moves*2)) | (getConnections() << sizeof(unsigned char)*8 - (moves*2))));
} }
//creates random centerpiece //creates random centerpiece
void PuzzlePiece::randomCenterPiece() void PuzzlePiece::randomCenterPiece()
{ {
setConnections(0b00000000); setConnections(0b00000000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b01000000); setConnections(getConnections() | 0b01000000);
else else
setConnections(getConnections() | 0b10000000); setConnections(getConnections() | 0b10000000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b00010000); setConnections(getConnections() | 0b00010000);
else else
setConnections(getConnections() | 0b00100000); setConnections(getConnections() | 0b00100000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b00000100); setConnections(getConnections() | 0b00000100);
else else
setConnections(getConnections() | 0b00001000); setConnections(getConnections() | 0b00001000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b00000001); setConnections(getConnections() | 0b00000001);
else else
setConnections(getConnections() | 0b00000010); setConnections(getConnections() | 0b00000010);
} }
//tries all pieces in box from separator to end and places fitting into matrix. removes fitting piece //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 //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. //seperator may be bigger than box size, if all puzzle pieces have already been looked at.
// it immediately retracts again then (returns -1) // it immediately retracts again then (returns -1)
unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox, unsigned int separator) unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox, unsigned int separator)
{ {
for(int i=separator; i<myBox.size();i++) for(int i=separator; i<myBox.size();i++)
{ {
if(testRotationPiece(m,n,myBox[i])) if(testRotationPiece(m,n,myBox[i]))
{ {
setPiece(m,n,myBox[i]); setPiece(m,n,myBox[i]);
myBox.erase(myBox.begin()+i); myBox.erase(myBox.begin()+i);
return i; return i;
} }
} }
return -1; return -1;
} }
//tests the myPart in all 4 rotations at position m, n //tests the myPart in all 4 rotations at position m, n
bool Puzzle::testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart) bool Puzzle::testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart)
{ {
for(int rotation=0; rotation < 4; rotation++) for(int rotation=0; rotation < 4; rotation++)
{ {
if(PlaceOfPartGood(m,n, myPart)) if(PlaceOfPartGood(m,n, myPart))
return 1; return 1;
myPart.shift(1); myPart.shift(1);
} }
#ifdef debug #ifdef debug
cout << "bad part: "; cout << "bad part: ";
myPart.printPiece(); myPart.printPiece();
cout << endl; cout << endl;
#endif #endif
return 0; return 0;
} }
//insterts piece at position in box according to boxidentifier and removes piece from puzzle //insterts piece at position in box according to boxidentifier and removes piece from puzzle
//this returns the position after!! the puzzle piece was put back in! not the boxidentifier of the piece. look that up in other function. //this returns the position after!! the puzzle piece was put back in! not the boxidentifier of the piece. look that up in other function.
unsigned int Puzzle::putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox) unsigned int Puzzle::putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox)
{ {
#ifdef debug #ifdef debug
cout << "putting back" << endl; cout << "putting back" << endl;
cout << "Old Box: "; cout << "Old Box: ";
printBox(myBox); printBox(myBox);
cout << endl; cout << endl;
#endif #endif
for(int i = 0; i < myBox.size();i++) for(int i = 0; i < myBox.size();i++)
{ {
if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier()) if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier())
{ {
myBox.insert(myBox.begin()+i,getPiece(m,n)); myBox.insert(myBox.begin()+i,getPiece(m,n));
removePiece(m,n); removePiece(m,n);
return i+1; return i+1;
} }
} }
//using push back, if the element was the last element in the vector chain //using push back, if the element was the last element in the vector chain
myBox.push_back(getPiece(m,n)); myBox.push_back(getPiece(m,n));
removePiece(m,n); removePiece(m,n);
return myBox.size(); return myBox.size();
} }
//checks if the myPart in its current orientation is legal in position m, n //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) bool Puzzle::PlaceOfPartGood(unsigned int m,unsigned int n, PuzzlePiece& myPart)
{ {
PuzzlePiece negativePart(0); PuzzlePiece negativePart(0);
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); 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-1,n).getConnections() & 0b00110000));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011));
negativePart.shift(2); negativePart.shift(2);
if ( if (
( ((((negativePart.getConnections() & 0b11000000) ^ (myPart.getConnections() & 0b11000000)) != 0b00000000) && (((myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000)) ( ((((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) == 0b11000000) || ((myPart.getConnections() & 0b11000000) == 0b11000000)) && (( myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000)
|| (((negativePart.getConnections() & 0b11000000) == 0b00000000) && ((myPart.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) ^ (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) == 0b00110000) || ((myPart.getConnections() & 0b00110000) == 0b00110000)) && (((myPart.getConnections() & 0b00110000) != 0b00000000) && (negativePart.getConnections() & 0b00110000) != 0b00000000))
|| (((negativePart.getConnections() & 0b00110000) == 0b00000000) && ((myPart.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) ^ (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) == 0b00001100) || ((myPart.getConnections() & 0b00001100) == 0b00001100)) && (((myPart.getConnections() & 0b00001100) != 0b00000000) && (negativePart.getConnections() & 0b00001100) != 0b00000000))
|| (((negativePart.getConnections() & 0b00001100) == 0b00000000) && ((myPart.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) ^ (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) == 0b00000011) || ((myPart.getConnections() & 0b00000011) == 0b00000011)) && (((myPart.getConnections() & 0b00000011) != 0b00000000) && (negativePart.getConnections() & 0b00000011) != 0b00000000))
|| (((negativePart.getConnections() & 0b00000011) == 0b00000000) && ((myPart.getConnections() & 0b00000011) == 0b00000000)) ) || (((negativePart.getConnections() & 0b00000011) == 0b00000000) && ((myPart.getConnections() & 0b00000011) == 0b00000000)) )
) )
{ {
#ifdef debug #ifdef debug
cout << "good Part: "; cout << "good Part: ";
myPart.printPiece(); myPart.printPiece();
cout << endl; cout << endl;
#endif #endif
return 1; return 1;
} }
return 0; return 0;
} }
//TODO!! //TODO!!
//simpler algorithm to the first placeofpartgood //simpler algorithm to the first placeofpartgood
//not yet functional!!! //not yet functional!!!
bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart) bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart)
{ {
/* /*
PuzzlePiece negativePart(0); PuzzlePiece negativePart(0);
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); 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-1,n).getConnections() & 0b00110000));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011));
negativePart.shift(2); negativePart.shift(2);
//A and D or B and C or not A and not B and not C and not D //A and D or B and C or not A and not B and not C and not D
if ( if (
( ( (negativePart.getConnections() & 0b10000000) & (myPart.getConnections() & 0b01000000)) ( ( (negativePart.getConnections() & 0b10000000) & (myPart.getConnections() & 0b01000000))
|| ( (negativePart.getConnections() & 0b01000000) & (myPart.getConnections() & 0b10000000)) || ( (negativePart.getConnections() & 0b01000000) & (myPart.getConnections() & 0b10000000))
|| ((!(negativePart.getConnections() & 0b10000000) & !(myPart.getConnections() & 0b10000000)) & (!(negativePart.getConnections() & 0b01000000) & !(myPart.getConnections() & 0b01000000))) || ((!(negativePart.getConnections() & 0b10000000) & !(myPart.getConnections() & 0b10000000)) & (!(negativePart.getConnections() & 0b01000000) & !(myPart.getConnections() & 0b01000000)))
) )
&& &&
( ( (negativePart.getConnections() & 0b00100000) & (myPart.getConnections() & 0b00010000)) ( ( (negativePart.getConnections() & 0b00100000) & (myPart.getConnections() & 0b00010000))
|| ( (negativePart.getConnections() & 0b00010000) & (myPart.getConnections() & 0b00100000)) || ( (negativePart.getConnections() & 0b00010000) & (myPart.getConnections() & 0b00100000))
|| ((!(negativePart.getConnections() & 0b00100000) & !(myPart.getConnections() & 0b00100000)) & (!(negativePart.getConnections() & 0b00010000) & !(myPart.getConnections() & 0b00010000))) || ((!(negativePart.getConnections() & 0b00100000) & !(myPart.getConnections() & 0b00100000)) & (!(negativePart.getConnections() & 0b00010000) & !(myPart.getConnections() & 0b00010000)))
) )
&& &&
( ( (negativePart.getConnections() & 0b00001000) & (myPart.getConnections() & 0b00000100)) ( ( (negativePart.getConnections() & 0b00001000) & (myPart.getConnections() & 0b00000100))
|| ( (negativePart.getConnections() & 0b00000100) & (myPart.getConnections() & 0b00001000)) || ( (negativePart.getConnections() & 0b00000100) & (myPart.getConnections() & 0b00001000))
|| ((!(negativePart.getConnections() & 0b00001000) & !(myPart.getConnections() & 0b00001000)) & (!(negativePart.getConnections() & 0b00000100) & !(myPart.getConnections() & 0b00000100))) || ((!(negativePart.getConnections() & 0b00001000) & !(myPart.getConnections() & 0b00001000)) & (!(negativePart.getConnections() & 0b00000100) & !(myPart.getConnections() & 0b00000100)))
) )
&& &&
( ( (negativePart.getConnections() & 0b00000010) & (myPart.getConnections() & 0b00000001)) ( ( (negativePart.getConnections() & 0b00000010) & (myPart.getConnections() & 0b00000001))
|| ( (negativePart.getConnections() & 0b00000001) & (myPart.getConnections() & 0b00000010)) || ( (negativePart.getConnections() & 0b00000001) & (myPart.getConnections() & 0b00000010))
|| ((!(negativePart.getConnections() & 0b00000010) & !(myPart.getConnections() & 0b00000010)) & (!(negativePart.getConnections() & 0b00000001) & !(myPart.getConnections() & 0b00000001))) || ((!(negativePart.getConnections() & 0b00000010) & !(myPart.getConnections() & 0b00000010)) & (!(negativePart.getConnections() & 0b00000001) & !(myPart.getConnections() & 0b00000001)))
) )
) )
return 1; return 1;
cout << "nogood" << endl; cout << "nogood" << endl;
return 0; return 0;
*/ */
PuzzlePiece tmpPuzzlePiece = myPart; PuzzlePiece tmpPuzzlePiece = myPart;
//make tmp a negativ part //make tmp a negativ part
if((tmpPuzzlePiece.Ringbuffer & 0b11000000) != 192 || 0) if((tmpPuzzlePiece.Ringbuffer & 0b11000000) != 192 || 0)
tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b11000000); tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b11000000);
if((tmpPuzzlePiece.Ringbuffer & 0b00110000) != 48 || 0) if((tmpPuzzlePiece.Ringbuffer & 0b00110000) != 48 || 0)
tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00110000); tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00110000);
if((tmpPuzzlePiece.Ringbuffer & 0b00001100) != 12 || 0) if((tmpPuzzlePiece.Ringbuffer & 0b00001100) != 12 || 0)
tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00001100); tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00001100);
if((tmpPuzzlePiece.Ringbuffer & 0b00000011) != 3 || 0) if((tmpPuzzlePiece.Ringbuffer & 0b00000011) != 3 || 0)
tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00000011); tmpPuzzlePiece.Ringbuffer = (tmpPuzzlePiece.Ringbuffer ^ 0b00000011);
PuzzlePiece negativePart(0); PuzzlePiece negativePart(0);
negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m,n+1).Ringbuffer & 0b11000000); 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-1,n).Ringbuffer & 0b00110000);
negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m,n-1).Ringbuffer & 0b00001100); negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m,n-1).Ringbuffer & 0b00001100);
negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m+1,n).Ringbuffer & 0b00000011); negativePart.Ringbuffer = negativePart.Ringbuffer | (this->sudogetPiece(m+1,n).Ringbuffer & 0b00000011);
negativePart.Shift(2); negativePart.Shift(2);
//check tmp part with environment //check tmp part with environment
if(((negativePart.Ringbuffer & 0b11000000) == (tmpPuzzlePiece & 0b11000000)) && ((negativePart.Ringbuffer & 0b00110000) == (tmpPuzzlePiece & 0b00110000)) if(((negativePart.Ringbuffer & 0b11000000) == (tmpPuzzlePiece & 0b11000000)) && ((negativePart.Ringbuffer & 0b00110000) == (tmpPuzzlePiece & 0b00110000))
&& ((negativePart.Ringbuffer & 0b00001100) == (tmpPuzzlePiece & 0b00001100)) && ((negativePart.Ringbuffer & 0b00000011) == (tmpPuzzlePiece & 0b00000011))) && ((negativePart.Ringbuffer & 0b00001100) == (tmpPuzzlePiece & 0b00001100)) && ((negativePart.Ringbuffer & 0b00000011) == (tmpPuzzlePiece & 0b00000011)))
return 1; return 1;
return 0; return 0;
} }
//prints the true puzzle (without 0 edges) //prints the true puzzle (without 0 edges)
void Puzzle::printPuzzle() void Puzzle::printPuzzle()
{ {
cout << "current Puzzle: " << endl; cout << "current Puzzle: " << endl;
for(int i=1;i<row+1;i++) for(int i=1;i<row+1;i++)
{ {
for(int j=1;j<col+1;j++) for(int j=1;j<col+1;j++)
{ {
Matrix[i][j].printPiece(); Matrix[i][j].printPiece();
cout << " "; cout << " ";
} }
cout << endl; cout << endl;
} }
cout << endl; cout << endl;
} }
//creates a legal puzzle out of random pieces //creates a legal puzzle out of random pieces
void randomBox::createRandomPuzzle() void randomBox::createRandomPuzzle()
{ {
PuzzlePiece temporaryRandomPiece(0); PuzzlePiece temporaryRandomPiece(0);
for(int i=0;i<getRows();i++) for(int i=0;i<getRows();i++)
{ {
for(int j = 0; j < getCols();) for(int j = 0; j < getCols();)
{ {
//create random piece, set edges according to position and check if piece is good //create random piece, set edges according to position and check if piece is good
temporaryRandomPiece.randomCenterPiece(); temporaryRandomPiece.randomCenterPiece();
if(i==0) if(i==0)
temporaryRandomPiece.setConnections(0b00111111 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b00111111 & temporaryRandomPiece.getConnections());
if(i==getRows()-1) if(i==getRows()-1)
temporaryRandomPiece.setConnections(0b11110011 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b11110011 & temporaryRandomPiece.getConnections());
if(j==0) if(j==0)
temporaryRandomPiece.setConnections(0b11111100 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b11111100 & temporaryRandomPiece.getConnections());
if(j==getCols()-1) if(j==getCols()-1)
temporaryRandomPiece.setConnections(0b11001111 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b11001111 & temporaryRandomPiece.getConnections());
if(PlaceOfPartGood(j,i,temporaryRandomPiece)) if(PlaceOfPartGood(j,i,temporaryRandomPiece))
{ {
temporaryRandomPiece.assignIdentifier(); temporaryRandomPiece.assignIdentifier();
setPiece(j,i,temporaryRandomPiece); setPiece(j,i,temporaryRandomPiece);
j++; j++;
Box.push_back(temporaryRandomPiece); Box.push_back(temporaryRandomPiece);
} }
} }
} }
} }
//prints a box contents on console //prints a box contents on console
void randomBox::printBox() void randomBox::printBox()
{ {
shuffle(); shuffle();
for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++) for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++)
{ {
(*i).printPiece(); (*i).printPiece();
cout << ' '; cout << ' ';
} }
cout << endl; cout << endl;
} }
//shuffles around a box, randomizing pieces and orientation //shuffles around a box, randomizing pieces and orientation
vector<PuzzlePiece> randomBox::shuffle() vector<PuzzlePiece> randomBox::shuffle()
{ {
random_shuffle(Box.begin(),Box.end()); random_shuffle(Box.begin(),Box.end());
for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++) for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++)
(*i).shift(rand()%4); (*i).shift(rand()%4);
numerateBox(Box); numerateBox(Box);
return Box; return Box;
} }
//creates a random box size m, n, shuffles it, and then retuns it //creates a random box size m, n, shuffles it, and then retuns it
vector<PuzzlePiece> createBox(uint m, uint n) vector<PuzzlePiece> createBox(uint m, uint n)
{ {
randomBox myFirstPuzzleBox(m,n); randomBox myFirstPuzzleBox(m,n);
myFirstPuzzleBox.createRandomPuzzle(); myFirstPuzzleBox.createRandomPuzzle();
return myFirstPuzzleBox.shuffle(); return myFirstPuzzleBox.shuffle();
} }
//prints contents of box //prints contents of box
void printBox(vector<PuzzlePiece> myBox) void printBox(vector<PuzzlePiece> myBox)
{ {
cout << "current Box: " << endl; cout << "current Box: " << endl;
for (vector<PuzzlePiece>::iterator i = myBox.begin(); i != myBox.end(); i++) for (vector<PuzzlePiece>::iterator i = myBox.begin(); i != myBox.end(); i++)
{ {
(*i).printPiece(); (*i).printPiece();
cout << ' '; cout << ' ';
} }
cout << endl; cout << endl;
return; return;
} }
//gives every element in box a box identifier. //gives every element in box a box identifier.
void numerateBox(vector<PuzzlePiece>& myBox) void numerateBox(vector<PuzzlePiece>& myBox)
{ {
for(int i = 0; i< myBox.size();i++) for(int i = 0; i< myBox.size();i++)
myBox[i].setBoxIdentifier(i); myBox[i].setBoxIdentifier(i);
return; return;
} }

View File

@ -1,406 +1,406 @@
void create4040hardBox(vector<PuzzlePiece>& myFirstBox) void create4040hardBox(vector<PuzzlePiece>& myFirstBox)
{ {
myFirstBox[0].setConnections(0b01101001); myFirstBox[0].setConnections(0b01101001);
myFirstBox[1].setConnections(0b10011001); myFirstBox[1].setConnections(0b10011001);
myFirstBox[2].setConnections(0b01100110); myFirstBox[2].setConnections(0b01100110);
myFirstBox[3].setConnections(0b01101001); myFirstBox[3].setConnections(0b01101001);
myFirstBox[4].setConnections(0b10100101); myFirstBox[4].setConnections(0b10100101);
myFirstBox[5].setConnections(0b10010010); myFirstBox[5].setConnections(0b10010010);
myFirstBox[6].setConnections(0b01101001); myFirstBox[6].setConnections(0b01101001);
myFirstBox[7].setConnections(0b00101010); myFirstBox[7].setConnections(0b00101010);
myFirstBox[8].setConnections(0b01000110); myFirstBox[8].setConnections(0b01000110);
myFirstBox[9].setConnections(0b01011010); myFirstBox[9].setConnections(0b01011010);
myFirstBox[10].setConnections(0b01011010); myFirstBox[10].setConnections(0b01011010);
myFirstBox[11].setConnections(0b10010101); myFirstBox[11].setConnections(0b10010101);
myFirstBox[12].setConnections(0b01010101); myFirstBox[12].setConnections(0b01010101);
myFirstBox[13].setConnections(0b10101001); myFirstBox[13].setConnections(0b10101001);
myFirstBox[14].setConnections(0b10010101); myFirstBox[14].setConnections(0b10010101);
myFirstBox[15].setConnections(0b10101010); myFirstBox[15].setConnections(0b10101010);
myFirstBox[16].setConnections(0b01101010); myFirstBox[16].setConnections(0b01101010);
myFirstBox[17].setConnections(0b01101010); myFirstBox[17].setConnections(0b01101010);
myFirstBox[18].setConnections(0b00100101); myFirstBox[18].setConnections(0b00100101);
myFirstBox[19].setConnections(0b01100101); myFirstBox[19].setConnections(0b01100101);
myFirstBox[20].setConnections(0b10010001); myFirstBox[20].setConnections(0b10010001);
myFirstBox[21].setConnections(0b10010101); myFirstBox[21].setConnections(0b10010101);
myFirstBox[22].setConnections(0b10101001); myFirstBox[22].setConnections(0b10101001);
myFirstBox[23].setConnections(0b01010110); myFirstBox[23].setConnections(0b01010110);
myFirstBox[24].setConnections(0b10101010); myFirstBox[24].setConnections(0b10101010);
myFirstBox[25].setConnections(0b01101000); myFirstBox[25].setConnections(0b01101000);
myFirstBox[26].setConnections(0b01101010); myFirstBox[26].setConnections(0b01101010);
myFirstBox[27].setConnections(0b10010101); myFirstBox[27].setConnections(0b10010101);
myFirstBox[28].setConnections(0b10011010); myFirstBox[28].setConnections(0b10011010);
myFirstBox[29].setConnections(0b10011001); myFirstBox[29].setConnections(0b10011001);
myFirstBox[30].setConnections(0b01101010); myFirstBox[30].setConnections(0b01101010);
myFirstBox[31].setConnections(0b01100001); myFirstBox[31].setConnections(0b01100001);
myFirstBox[32].setConnections(0b01101010); myFirstBox[32].setConnections(0b01101010);
myFirstBox[33].setConnections(0b01100101); myFirstBox[33].setConnections(0b01100101);
myFirstBox[34].setConnections(0b01010101); myFirstBox[34].setConnections(0b01010101);
myFirstBox[35].setConnections(0b01010110); myFirstBox[35].setConnections(0b01010110);
myFirstBox[36].setConnections(0b01101010); myFirstBox[36].setConnections(0b01101010);
myFirstBox[37].setConnections(0b01010110); myFirstBox[37].setConnections(0b01010110);
myFirstBox[38].setConnections(0b01100110); myFirstBox[38].setConnections(0b01100110);
myFirstBox[39].setConnections(0b01011010); myFirstBox[39].setConnections(0b01011010);
myFirstBox[40].setConnections(0b01100101); myFirstBox[40].setConnections(0b01100101);
myFirstBox[41].setConnections(0b01101001); myFirstBox[41].setConnections(0b01101001);
myFirstBox[42].setConnections(0b01010110); myFirstBox[42].setConnections(0b01010110);
myFirstBox[43].setConnections(0b01000110); myFirstBox[43].setConnections(0b01000110);
myFirstBox[44].setConnections(0b01011001); myFirstBox[44].setConnections(0b01011001);
myFirstBox[45].setConnections(0b01101001); myFirstBox[45].setConnections(0b01101001);
myFirstBox[46].setConnections(0b10000101); myFirstBox[46].setConnections(0b10000101);
myFirstBox[47].setConnections(0b10011010); myFirstBox[47].setConnections(0b10011010);
myFirstBox[48].setConnections(0b10010110); myFirstBox[48].setConnections(0b10010110);
myFirstBox[49].setConnections(0b01011010); myFirstBox[49].setConnections(0b01011010);
myFirstBox[50].setConnections(0b10011001); myFirstBox[50].setConnections(0b10011001);
myFirstBox[51].setConnections(0b01001001); myFirstBox[51].setConnections(0b01001001);
myFirstBox[52].setConnections(0b10100110); myFirstBox[52].setConnections(0b10100110);
myFirstBox[53].setConnections(0b01001010); myFirstBox[53].setConnections(0b01001010);
myFirstBox[54].setConnections(0b10010010); myFirstBox[54].setConnections(0b10010010);
myFirstBox[55].setConnections(0b01001010); myFirstBox[55].setConnections(0b01001010);
myFirstBox[56].setConnections(0b01101001); myFirstBox[56].setConnections(0b01101001);
myFirstBox[57].setConnections(0b10100110); myFirstBox[57].setConnections(0b10100110);
myFirstBox[58].setConnections(0b10010110); myFirstBox[58].setConnections(0b10010110);
myFirstBox[59].setConnections(0b10010110); myFirstBox[59].setConnections(0b10010110);
myFirstBox[60].setConnections(0b10101001); myFirstBox[60].setConnections(0b10101001);
myFirstBox[61].setConnections(0b00100101); myFirstBox[61].setConnections(0b00100101);
myFirstBox[62].setConnections(0b00101001); myFirstBox[62].setConnections(0b00101001);
myFirstBox[63].setConnections(0b01101001); myFirstBox[63].setConnections(0b01101001);
myFirstBox[64].setConnections(0b01101001); myFirstBox[64].setConnections(0b01101001);
myFirstBox[65].setConnections(0b00100101); myFirstBox[65].setConnections(0b00100101);
myFirstBox[66].setConnections(0b10010110); myFirstBox[66].setConnections(0b10010110);
myFirstBox[67].setConnections(0b10011010); myFirstBox[67].setConnections(0b10011010);
myFirstBox[68].setConnections(0b01100110); myFirstBox[68].setConnections(0b01100110);
myFirstBox[69].setConnections(0b10010110); myFirstBox[69].setConnections(0b10010110);
myFirstBox[70].setConnections(0b01010100); myFirstBox[70].setConnections(0b01010100);
myFirstBox[71].setConnections(0b01011010); myFirstBox[71].setConnections(0b01011010);
myFirstBox[72].setConnections(0b01100110); myFirstBox[72].setConnections(0b01100110);
myFirstBox[73].setConnections(0b01100101); myFirstBox[73].setConnections(0b01100101);
myFirstBox[74].setConnections(0b10011010); myFirstBox[74].setConnections(0b10011010);
myFirstBox[75].setConnections(0b10010101); myFirstBox[75].setConnections(0b10010101);
myFirstBox[76].setConnections(0b10011010); myFirstBox[76].setConnections(0b10011010);
myFirstBox[77].setConnections(0b01100101); myFirstBox[77].setConnections(0b01100101);
myFirstBox[78].setConnections(0b10011010); myFirstBox[78].setConnections(0b10011010);
myFirstBox[79].setConnections(0b01010110); myFirstBox[79].setConnections(0b01010110);
myFirstBox[80].setConnections(0b01101010); myFirstBox[80].setConnections(0b01101010);
myFirstBox[81].setConnections(0b01010101); myFirstBox[81].setConnections(0b01010101);
myFirstBox[82].setConnections(0b01100101); myFirstBox[82].setConnections(0b01100101);
myFirstBox[83].setConnections(0b10100101); myFirstBox[83].setConnections(0b10100101);
myFirstBox[84].setConnections(0b01010110); myFirstBox[84].setConnections(0b01010110);
myFirstBox[85].setConnections(0b01101010); myFirstBox[85].setConnections(0b01101010);
myFirstBox[86].setConnections(0b10011010); myFirstBox[86].setConnections(0b10011010);
myFirstBox[87].setConnections(0b10010110); myFirstBox[87].setConnections(0b10010110);
myFirstBox[88].setConnections(0b01101010); myFirstBox[88].setConnections(0b01101010);
myFirstBox[89].setConnections(0b01011010); myFirstBox[89].setConnections(0b01011010);
myFirstBox[90].setConnections(0b01010110); myFirstBox[90].setConnections(0b01010110);
myFirstBox[91].setConnections(0b01100101); myFirstBox[91].setConnections(0b01100101);
myFirstBox[92].setConnections(0b00100101); myFirstBox[92].setConnections(0b00100101);
myFirstBox[93].setConnections(0b10100101); myFirstBox[93].setConnections(0b10100101);
myFirstBox[94].setConnections(0b10010110); myFirstBox[94].setConnections(0b10010110);
myFirstBox[95].setConnections(0b01100110); myFirstBox[95].setConnections(0b01100110);
myFirstBox[96].setConnections(0b10000110); myFirstBox[96].setConnections(0b10000110);
myFirstBox[97].setConnections(0b01001001); myFirstBox[97].setConnections(0b01001001);
myFirstBox[98].setConnections(0b10010110); myFirstBox[98].setConnections(0b10010110);
myFirstBox[99].setConnections(0b10100110); myFirstBox[99].setConnections(0b10100110);
myFirstBox[100].setConnections(0b10100110); myFirstBox[100].setConnections(0b10100110);
myFirstBox[101].setConnections(0b01100010); myFirstBox[101].setConnections(0b01100010);
myFirstBox[102].setConnections(0b01101010); myFirstBox[102].setConnections(0b01101010);
myFirstBox[103].setConnections(0b10011001); myFirstBox[103].setConnections(0b10011001);
myFirstBox[104].setConnections(0b01010101); myFirstBox[104].setConnections(0b01010101);
myFirstBox[105].setConnections(0b10011010); myFirstBox[105].setConnections(0b10011010);
myFirstBox[106].setConnections(0b10101001); myFirstBox[106].setConnections(0b10101001);
myFirstBox[107].setConnections(0b01100110); myFirstBox[107].setConnections(0b01100110);
myFirstBox[108].setConnections(0b10101001); myFirstBox[108].setConnections(0b10101001);
myFirstBox[109].setConnections(0b10101001); myFirstBox[109].setConnections(0b10101001);
myFirstBox[110].setConnections(0b10010100); myFirstBox[110].setConnections(0b10010100);
myFirstBox[111].setConnections(0b01100110); myFirstBox[111].setConnections(0b01100110);
myFirstBox[112].setConnections(0b01010110); myFirstBox[112].setConnections(0b01010110);
myFirstBox[113].setConnections(0b10010101); myFirstBox[113].setConnections(0b10010101);
myFirstBox[114].setConnections(0b01011001); myFirstBox[114].setConnections(0b01011001);
myFirstBox[115].setConnections(0b01101010); myFirstBox[115].setConnections(0b01101010);
myFirstBox[116].setConnections(0b10100110); myFirstBox[116].setConnections(0b10100110);
myFirstBox[117].setConnections(0b10100101); myFirstBox[117].setConnections(0b10100101);
myFirstBox[118].setConnections(0b10101010); myFirstBox[118].setConnections(0b10101010);
myFirstBox[119].setConnections(0b01011010); myFirstBox[119].setConnections(0b01011010);
myFirstBox[120].setConnections(0b10011000); myFirstBox[120].setConnections(0b10011000);
myFirstBox[121].setConnections(0b10010101); myFirstBox[121].setConnections(0b10010101);
myFirstBox[122].setConnections(0b10100101); myFirstBox[122].setConnections(0b10100101);
myFirstBox[123].setConnections(0b10000110); myFirstBox[123].setConnections(0b10000110);
myFirstBox[124].setConnections(0b01100101); myFirstBox[124].setConnections(0b01100101);
myFirstBox[125].setConnections(0b10100110); myFirstBox[125].setConnections(0b10100110);
myFirstBox[126].setConnections(0b10101010); myFirstBox[126].setConnections(0b10101010);
myFirstBox[127].setConnections(0b01101001); myFirstBox[127].setConnections(0b01101001);
myFirstBox[128].setConnections(0b01010101); myFirstBox[128].setConnections(0b01010101);
myFirstBox[129].setConnections(0b01100101); myFirstBox[129].setConnections(0b01100101);
myFirstBox[130].setConnections(0b10001001); myFirstBox[130].setConnections(0b10001001);
myFirstBox[131].setConnections(0b01101010); myFirstBox[131].setConnections(0b01101010);
myFirstBox[132].setConnections(0b01101010); myFirstBox[132].setConnections(0b01101010);
myFirstBox[133].setConnections(0b01100010); myFirstBox[133].setConnections(0b01100010);
myFirstBox[134].setConnections(0b01100110); myFirstBox[134].setConnections(0b01100110);
myFirstBox[135].setConnections(0b10100001); myFirstBox[135].setConnections(0b10100001);
myFirstBox[136].setConnections(0b10011001); myFirstBox[136].setConnections(0b10011001);
myFirstBox[137].setConnections(0b01101010); myFirstBox[137].setConnections(0b01101010);
myFirstBox[138].setConnections(0b01011001); myFirstBox[138].setConnections(0b01011001);
myFirstBox[139].setConnections(0b10001001); myFirstBox[139].setConnections(0b10001001);
myFirstBox[140].setConnections(0b01010101); myFirstBox[140].setConnections(0b01010101);
myFirstBox[141].setConnections(0b10100101); myFirstBox[141].setConnections(0b10100101);
myFirstBox[142].setConnections(0b01100101); myFirstBox[142].setConnections(0b01100101);
myFirstBox[143].setConnections(0b10100101); myFirstBox[143].setConnections(0b10100101);
myFirstBox[144].setConnections(0b10011010); myFirstBox[144].setConnections(0b10011010);
myFirstBox[145].setConnections(0b10010001); myFirstBox[145].setConnections(0b10010001);
myFirstBox[146].setConnections(0b10100110); myFirstBox[146].setConnections(0b10100110);
myFirstBox[147].setConnections(0b01101010); myFirstBox[147].setConnections(0b01101010);
myFirstBox[148].setConnections(0b10010101); myFirstBox[148].setConnections(0b10010101);
myFirstBox[149].setConnections(0b01100101); myFirstBox[149].setConnections(0b01100101);
myFirstBox[150].setConnections(0b10100101); myFirstBox[150].setConnections(0b10100101);
myFirstBox[151].setConnections(0b10100110); myFirstBox[151].setConnections(0b10100110);
myFirstBox[152].setConnections(0b10010001); myFirstBox[152].setConnections(0b10010001);
myFirstBox[153].setConnections(0b10101000); myFirstBox[153].setConnections(0b10101000);
myFirstBox[154].setConnections(0b10011010); myFirstBox[154].setConnections(0b10011010);
myFirstBox[155].setConnections(0b10100110); myFirstBox[155].setConnections(0b10100110);
myFirstBox[156].setConnections(0b01100110); myFirstBox[156].setConnections(0b01100110);
myFirstBox[157].setConnections(0b10100110); myFirstBox[157].setConnections(0b10100110);
myFirstBox[158].setConnections(0b01011010); myFirstBox[158].setConnections(0b01011010);
myFirstBox[159].setConnections(0b10100001); myFirstBox[159].setConnections(0b10100001);
myFirstBox[160].setConnections(0b01010101); myFirstBox[160].setConnections(0b01010101);
myFirstBox[161].setConnections(0b10011010); myFirstBox[161].setConnections(0b10011010);
myFirstBox[162].setConnections(0b10101001); myFirstBox[162].setConnections(0b10101001);
myFirstBox[163].setConnections(0b01010110); myFirstBox[163].setConnections(0b01010110);
myFirstBox[164].setConnections(0b01100001); myFirstBox[164].setConnections(0b01100001);
myFirstBox[165].setConnections(0b01011001); myFirstBox[165].setConnections(0b01011001);
myFirstBox[166].setConnections(0b01101001); myFirstBox[166].setConnections(0b01101001);
myFirstBox[167].setConnections(0b10011001); myFirstBox[167].setConnections(0b10011001);
myFirstBox[168].setConnections(0b10010101); myFirstBox[168].setConnections(0b10010101);
myFirstBox[169].setConnections(0b01100010); myFirstBox[169].setConnections(0b01100010);
myFirstBox[170].setConnections(0b01010110); myFirstBox[170].setConnections(0b01010110);
myFirstBox[171].setConnections(0b00010101); myFirstBox[171].setConnections(0b00010101);
myFirstBox[172].setConnections(0b10100101); myFirstBox[172].setConnections(0b10100101);
myFirstBox[173].setConnections(0b10101010); myFirstBox[173].setConnections(0b10101010);
myFirstBox[174].setConnections(0b10011010); myFirstBox[174].setConnections(0b10011010);
myFirstBox[175].setConnections(0b01100101); myFirstBox[175].setConnections(0b01100101);
myFirstBox[176].setConnections(0b10100110); myFirstBox[176].setConnections(0b10100110);
myFirstBox[177].setConnections(0b10101001); myFirstBox[177].setConnections(0b10101001);
myFirstBox[178].setConnections(0b01011010); myFirstBox[178].setConnections(0b01011010);
myFirstBox[179].setConnections(0b01101001); myFirstBox[179].setConnections(0b01101001);
myFirstBox[180].setConnections(0b10010101); myFirstBox[180].setConnections(0b10010101);
myFirstBox[181].setConnections(0b01101010); myFirstBox[181].setConnections(0b01101010);
myFirstBox[182].setConnections(0b10010110); myFirstBox[182].setConnections(0b10010110);
myFirstBox[183].setConnections(0b10010110); myFirstBox[183].setConnections(0b10010110);
myFirstBox[184].setConnections(0b10011001); myFirstBox[184].setConnections(0b10011001);
myFirstBox[185].setConnections(0b10100101); myFirstBox[185].setConnections(0b10100101);
myFirstBox[186].setConnections(0b10010110); myFirstBox[186].setConnections(0b10010110);
myFirstBox[187].setConnections(0b10010110); myFirstBox[187].setConnections(0b10010110);
myFirstBox[188].setConnections(0b10011010); myFirstBox[188].setConnections(0b10011010);
myFirstBox[189].setConnections(0b10010101); myFirstBox[189].setConnections(0b10010101);
myFirstBox[190].setConnections(0b01010001); myFirstBox[190].setConnections(0b01010001);
myFirstBox[191].setConnections(0b01010100); myFirstBox[191].setConnections(0b01010100);
myFirstBox[192].setConnections(0b10101000); myFirstBox[192].setConnections(0b10101000);
myFirstBox[193].setConnections(0b10100110); myFirstBox[193].setConnections(0b10100110);
myFirstBox[194].setConnections(0b01010001); myFirstBox[194].setConnections(0b01010001);
myFirstBox[195].setConnections(0b01010101); myFirstBox[195].setConnections(0b01010101);
myFirstBox[196].setConnections(0b01100110); myFirstBox[196].setConnections(0b01100110);
myFirstBox[197].setConnections(0b10100101); myFirstBox[197].setConnections(0b10100101);
myFirstBox[198].setConnections(0b00100101); myFirstBox[198].setConnections(0b00100101);
myFirstBox[199].setConnections(0b00100101); myFirstBox[199].setConnections(0b00100101);
myFirstBox[200].setConnections(0b10101001); myFirstBox[200].setConnections(0b10101001);
myFirstBox[201].setConnections(0b10101001); myFirstBox[201].setConnections(0b10101001);
myFirstBox[202].setConnections(0b01011001); myFirstBox[202].setConnections(0b01011001);
myFirstBox[203].setConnections(0b00001010); myFirstBox[203].setConnections(0b00001010);
myFirstBox[204].setConnections(0b01010101); myFirstBox[204].setConnections(0b01010101);
myFirstBox[205].setConnections(0b10011010); myFirstBox[205].setConnections(0b10011010);
myFirstBox[206].setConnections(0b10100110); myFirstBox[206].setConnections(0b10100110);
myFirstBox[207].setConnections(0b10100101); myFirstBox[207].setConnections(0b10100101);
myFirstBox[208].setConnections(0b10011001); myFirstBox[208].setConnections(0b10011001);
myFirstBox[209].setConnections(0b10100110); myFirstBox[209].setConnections(0b10100110);
myFirstBox[210].setConnections(0b10101010); myFirstBox[210].setConnections(0b10101010);
myFirstBox[211].setConnections(0b01010110); myFirstBox[211].setConnections(0b01010110);
myFirstBox[212].setConnections(0b01010101); myFirstBox[212].setConnections(0b01010101);
myFirstBox[213].setConnections(0b01100010); myFirstBox[213].setConnections(0b01100010);
myFirstBox[214].setConnections(0b10010110); myFirstBox[214].setConnections(0b10010110);
myFirstBox[215].setConnections(0b10011010); myFirstBox[215].setConnections(0b10011010);
myFirstBox[216].setConnections(0b01100100); myFirstBox[216].setConnections(0b01100100);
myFirstBox[217].setConnections(0b01010101); myFirstBox[217].setConnections(0b01010101);
myFirstBox[218].setConnections(0b10011010); myFirstBox[218].setConnections(0b10011010);
myFirstBox[219].setConnections(0b01100101); myFirstBox[219].setConnections(0b01100101);
myFirstBox[220].setConnections(0b10101001); myFirstBox[220].setConnections(0b10101001);
myFirstBox[221].setConnections(0b10010101); myFirstBox[221].setConnections(0b10010101);
myFirstBox[222].setConnections(0b10100101); myFirstBox[222].setConnections(0b10100101);
myFirstBox[223].setConnections(0b10101001); myFirstBox[223].setConnections(0b10101001);
myFirstBox[224].setConnections(0b10100110); myFirstBox[224].setConnections(0b10100110);
myFirstBox[225].setConnections(0b10011001); myFirstBox[225].setConnections(0b10011001);
myFirstBox[226].setConnections(0b01011010); myFirstBox[226].setConnections(0b01011010);
myFirstBox[227].setConnections(0b01000101); myFirstBox[227].setConnections(0b01000101);
myFirstBox[228].setConnections(0b01100110); myFirstBox[228].setConnections(0b01100110);
myFirstBox[229].setConnections(0b10101010); myFirstBox[229].setConnections(0b10101010);
myFirstBox[230].setConnections(0b01010100); myFirstBox[230].setConnections(0b01010100);
myFirstBox[231].setConnections(0b10101010); myFirstBox[231].setConnections(0b10101010);
myFirstBox[232].setConnections(0b10011010); myFirstBox[232].setConnections(0b10011010);
myFirstBox[233].setConnections(0b10100110); myFirstBox[233].setConnections(0b10100110);
myFirstBox[234].setConnections(0b10011000); myFirstBox[234].setConnections(0b10011000);
myFirstBox[235].setConnections(0b10011001); myFirstBox[235].setConnections(0b10011001);
myFirstBox[236].setConnections(0b01010101); myFirstBox[236].setConnections(0b01010101);
myFirstBox[237].setConnections(0b01001010); myFirstBox[237].setConnections(0b01001010);
myFirstBox[238].setConnections(0b01100001); myFirstBox[238].setConnections(0b01100001);
myFirstBox[239].setConnections(0b10011010); myFirstBox[239].setConnections(0b10011010);
myFirstBox[240].setConnections(0b10010101); myFirstBox[240].setConnections(0b10010101);
myFirstBox[241].setConnections(0b10100110); myFirstBox[241].setConnections(0b10100110);
myFirstBox[242].setConnections(0b01010101); myFirstBox[242].setConnections(0b01010101);
myFirstBox[243].setConnections(0b10010101); myFirstBox[243].setConnections(0b10010101);
myFirstBox[244].setConnections(0b01101010); myFirstBox[244].setConnections(0b01101010);
myFirstBox[245].setConnections(0b01101010); myFirstBox[245].setConnections(0b01101010);
myFirstBox[246].setConnections(0b10100100); myFirstBox[246].setConnections(0b10100100);
myFirstBox[247].setConnections(0b00101010); myFirstBox[247].setConnections(0b00101010);
myFirstBox[248].setConnections(0b01100110); myFirstBox[248].setConnections(0b01100110);
myFirstBox[249].setConnections(0b01101000); myFirstBox[249].setConnections(0b01101000);
myFirstBox[250].setConnections(0b01101001); myFirstBox[250].setConnections(0b01101001);
myFirstBox[251].setConnections(0b10101001); myFirstBox[251].setConnections(0b10101001);
myFirstBox[252].setConnections(0b01010110); myFirstBox[252].setConnections(0b01010110);
myFirstBox[253].setConnections(0b10010110); myFirstBox[253].setConnections(0b10010110);
myFirstBox[254].setConnections(0b01100101); myFirstBox[254].setConnections(0b01100101);
myFirstBox[255].setConnections(0b01011001); myFirstBox[255].setConnections(0b01011001);
myFirstBox[256].setConnections(0b01100110); myFirstBox[256].setConnections(0b01100110);
myFirstBox[257].setConnections(0b00100101); myFirstBox[257].setConnections(0b00100101);
myFirstBox[258].setConnections(0b01101001); myFirstBox[258].setConnections(0b01101001);
myFirstBox[259].setConnections(0b10010110); myFirstBox[259].setConnections(0b10010110);
myFirstBox[260].setConnections(0b10011001); myFirstBox[260].setConnections(0b10011001);
myFirstBox[261].setConnections(0b10011001); myFirstBox[261].setConnections(0b10011001);
myFirstBox[262].setConnections(0b01101001); myFirstBox[262].setConnections(0b01101001);
myFirstBox[263].setConnections(0b01010010); myFirstBox[263].setConnections(0b01010010);
myFirstBox[264].setConnections(0b10101010); myFirstBox[264].setConnections(0b10101010);
myFirstBox[265].setConnections(0b01101001); myFirstBox[265].setConnections(0b01101001);
myFirstBox[266].setConnections(0b01101001); myFirstBox[266].setConnections(0b01101001);
myFirstBox[267].setConnections(0b01101001); myFirstBox[267].setConnections(0b01101001);
myFirstBox[268].setConnections(0b10010110); myFirstBox[268].setConnections(0b10010110);
myFirstBox[269].setConnections(0b10011001); myFirstBox[269].setConnections(0b10011001);
myFirstBox[270].setConnections(0b01101010); myFirstBox[270].setConnections(0b01101010);
myFirstBox[271].setConnections(0b10000110); myFirstBox[271].setConnections(0b10000110);
myFirstBox[272].setConnections(0b10010101); myFirstBox[272].setConnections(0b10010101);
myFirstBox[273].setConnections(0b00010101); myFirstBox[273].setConnections(0b00010101);
myFirstBox[274].setConnections(0b10101010); myFirstBox[274].setConnections(0b10101010);
myFirstBox[275].setConnections(0b01010110); myFirstBox[275].setConnections(0b01010110);
myFirstBox[276].setConnections(0b01100100); myFirstBox[276].setConnections(0b01100100);
myFirstBox[277].setConnections(0b01010101); myFirstBox[277].setConnections(0b01010101);
myFirstBox[278].setConnections(0b10010101); myFirstBox[278].setConnections(0b10010101);
myFirstBox[279].setConnections(0b01010101); myFirstBox[279].setConnections(0b01010101);
myFirstBox[280].setConnections(0b01011010); myFirstBox[280].setConnections(0b01011010);
myFirstBox[281].setConnections(0b10011010); myFirstBox[281].setConnections(0b10011010);
myFirstBox[282].setConnections(0b00010101); myFirstBox[282].setConnections(0b00010101);
myFirstBox[283].setConnections(0b10010110); myFirstBox[283].setConnections(0b10010110);
myFirstBox[284].setConnections(0b10100101); myFirstBox[284].setConnections(0b10100101);
myFirstBox[285].setConnections(0b10010101); myFirstBox[285].setConnections(0b10010101);
myFirstBox[286].setConnections(0b01101001); myFirstBox[286].setConnections(0b01101001);
myFirstBox[287].setConnections(0b10100101); myFirstBox[287].setConnections(0b10100101);
myFirstBox[288].setConnections(0b01101001); myFirstBox[288].setConnections(0b01101001);
myFirstBox[289].setConnections(0b10011001); myFirstBox[289].setConnections(0b10011001);
myFirstBox[290].setConnections(0b01011001); myFirstBox[290].setConnections(0b01011001);
myFirstBox[291].setConnections(0b10010110); myFirstBox[291].setConnections(0b10010110);
myFirstBox[292].setConnections(0b01010101); myFirstBox[292].setConnections(0b01010101);
myFirstBox[293].setConnections(0b10100110); myFirstBox[293].setConnections(0b10100110);
myFirstBox[294].setConnections(0b10101001); myFirstBox[294].setConnections(0b10101001);
myFirstBox[295].setConnections(0b10101001); myFirstBox[295].setConnections(0b10101001);
myFirstBox[296].setConnections(0b01011010); myFirstBox[296].setConnections(0b01011010);
myFirstBox[297].setConnections(0b10100101); myFirstBox[297].setConnections(0b10100101);
myFirstBox[298].setConnections(0b01011010); myFirstBox[298].setConnections(0b01011010);
myFirstBox[299].setConnections(0b01100110); myFirstBox[299].setConnections(0b01100110);
myFirstBox[300].setConnections(0b10010101); myFirstBox[300].setConnections(0b10010101);
myFirstBox[301].setConnections(0b10101001); myFirstBox[301].setConnections(0b10101001);
myFirstBox[302].setConnections(0b10011001); myFirstBox[302].setConnections(0b10011001);
myFirstBox[303].setConnections(0b01010101); myFirstBox[303].setConnections(0b01010101);
myFirstBox[304].setConnections(0b01010101); myFirstBox[304].setConnections(0b01010101);
myFirstBox[305].setConnections(0b10101001); myFirstBox[305].setConnections(0b10101001);
myFirstBox[306].setConnections(0b01100101); myFirstBox[306].setConnections(0b01100101);
myFirstBox[307].setConnections(0b01101000); myFirstBox[307].setConnections(0b01101000);
myFirstBox[308].setConnections(0b01010101); myFirstBox[308].setConnections(0b01010101);
myFirstBox[309].setConnections(0b10010110); myFirstBox[309].setConnections(0b10010110);
myFirstBox[310].setConnections(0b10010110); myFirstBox[310].setConnections(0b10010110);
myFirstBox[311].setConnections(0b01011010); myFirstBox[311].setConnections(0b01011010);
myFirstBox[312].setConnections(0b10010110); myFirstBox[312].setConnections(0b10010110);
myFirstBox[313].setConnections(0b01011001); myFirstBox[313].setConnections(0b01011001);
myFirstBox[314].setConnections(0b01010110); myFirstBox[314].setConnections(0b01010110);
myFirstBox[315].setConnections(0b01101001); myFirstBox[315].setConnections(0b01101001);
myFirstBox[316].setConnections(0b10100101); myFirstBox[316].setConnections(0b10100101);
myFirstBox[317].setConnections(0b10101010); myFirstBox[317].setConnections(0b10101010);
myFirstBox[318].setConnections(0b10011001); myFirstBox[318].setConnections(0b10011001);
myFirstBox[319].setConnections(0b01010110); myFirstBox[319].setConnections(0b01010110);
myFirstBox[320].setConnections(0b10100000); myFirstBox[320].setConnections(0b10100000);
myFirstBox[321].setConnections(0b10100101); myFirstBox[321].setConnections(0b10100101);
myFirstBox[322].setConnections(0b00010101); myFirstBox[322].setConnections(0b00010101);
myFirstBox[323].setConnections(0b01010110); myFirstBox[323].setConnections(0b01010110);
myFirstBox[324].setConnections(0b01101010); myFirstBox[324].setConnections(0b01101010);
myFirstBox[325].setConnections(0b10010110); myFirstBox[325].setConnections(0b10010110);
myFirstBox[326].setConnections(0b00001001); myFirstBox[326].setConnections(0b00001001);
myFirstBox[327].setConnections(0b10011010); myFirstBox[327].setConnections(0b10011010);
myFirstBox[328].setConnections(0b10101010); myFirstBox[328].setConnections(0b10101010);
myFirstBox[329].setConnections(0b01100101); myFirstBox[329].setConnections(0b01100101);
myFirstBox[330].setConnections(0b01011010); myFirstBox[330].setConnections(0b01011010);
myFirstBox[331].setConnections(0b01101010); myFirstBox[331].setConnections(0b01101010);
myFirstBox[332].setConnections(0b10100101); myFirstBox[332].setConnections(0b10100101);
myFirstBox[333].setConnections(0b10100101); myFirstBox[333].setConnections(0b10100101);
myFirstBox[334].setConnections(0b01011000); myFirstBox[334].setConnections(0b01011000);
myFirstBox[335].setConnections(0b01010110); myFirstBox[335].setConnections(0b01010110);
myFirstBox[336].setConnections(0b00100110); myFirstBox[336].setConnections(0b00100110);
myFirstBox[337].setConnections(0b01101010); myFirstBox[337].setConnections(0b01101010);
myFirstBox[338].setConnections(0b01101010); myFirstBox[338].setConnections(0b01101010);
myFirstBox[339].setConnections(0b10010110); myFirstBox[339].setConnections(0b10010110);
myFirstBox[340].setConnections(0b10101010); myFirstBox[340].setConnections(0b10101010);
myFirstBox[341].setConnections(0b01100110); myFirstBox[341].setConnections(0b01100110);
myFirstBox[342].setConnections(0b10011000); myFirstBox[342].setConnections(0b10011000);
myFirstBox[343].setConnections(0b10101010); myFirstBox[343].setConnections(0b10101010);
myFirstBox[344].setConnections(0b01011001); myFirstBox[344].setConnections(0b01011001);
myFirstBox[345].setConnections(0b01101001); myFirstBox[345].setConnections(0b01101001);
myFirstBox[346].setConnections(0b10010101); myFirstBox[346].setConnections(0b10010101);
myFirstBox[347].setConnections(0b10101010); myFirstBox[347].setConnections(0b10101010);
myFirstBox[348].setConnections(0b10011001); myFirstBox[348].setConnections(0b10011001);
myFirstBox[349].setConnections(0b01101001); myFirstBox[349].setConnections(0b01101001);
myFirstBox[350].setConnections(0b01010110); myFirstBox[350].setConnections(0b01010110);
myFirstBox[351].setConnections(0b10000110); myFirstBox[351].setConnections(0b10000110);
myFirstBox[352].setConnections(0b10010110); myFirstBox[352].setConnections(0b10010110);
myFirstBox[353].setConnections(0b10011010); myFirstBox[353].setConnections(0b10011010);
myFirstBox[354].setConnections(0b01010110); myFirstBox[354].setConnections(0b01010110);
myFirstBox[355].setConnections(0b10010010); myFirstBox[355].setConnections(0b10010010);
myFirstBox[356].setConnections(0b10100110); myFirstBox[356].setConnections(0b10100110);
myFirstBox[357].setConnections(0b10101001); myFirstBox[357].setConnections(0b10101001);
myFirstBox[358].setConnections(0b01011001); myFirstBox[358].setConnections(0b01011001);
myFirstBox[359].setConnections(0b01010000); myFirstBox[359].setConnections(0b01010000);
myFirstBox[360].setConnections(0b10011001); myFirstBox[360].setConnections(0b10011001);
myFirstBox[361].setConnections(0b01101001); myFirstBox[361].setConnections(0b01101001);
myFirstBox[362].setConnections(0b01100001); myFirstBox[362].setConnections(0b01100001);
myFirstBox[363].setConnections(0b10100110); myFirstBox[363].setConnections(0b10100110);
myFirstBox[364].setConnections(0b10100101); myFirstBox[364].setConnections(0b10100101);
myFirstBox[365].setConnections(0b01100101); myFirstBox[365].setConnections(0b01100101);
myFirstBox[366].setConnections(0b01001010); myFirstBox[366].setConnections(0b01001010);
myFirstBox[367].setConnections(0b10010110); myFirstBox[367].setConnections(0b10010110);
myFirstBox[368].setConnections(0b10010101); myFirstBox[368].setConnections(0b10010101);
myFirstBox[369].setConnections(0b10010100); myFirstBox[369].setConnections(0b10010100);
myFirstBox[370].setConnections(0b01010101); myFirstBox[370].setConnections(0b01010101);
myFirstBox[371].setConnections(0b01011000); myFirstBox[371].setConnections(0b01011000);
myFirstBox[372].setConnections(0b01100010); myFirstBox[372].setConnections(0b01100010);
myFirstBox[373].setConnections(0b10011001); myFirstBox[373].setConnections(0b10011001);
myFirstBox[374].setConnections(0b01100110); myFirstBox[374].setConnections(0b01100110);
myFirstBox[375].setConnections(0b10100101); myFirstBox[375].setConnections(0b10100101);
myFirstBox[376].setConnections(0b01000110); myFirstBox[376].setConnections(0b01000110);
myFirstBox[377].setConnections(0b01010101); myFirstBox[377].setConnections(0b01010101);
myFirstBox[378].setConnections(0b01100110); myFirstBox[378].setConnections(0b01100110);
myFirstBox[379].setConnections(0b10100110); myFirstBox[379].setConnections(0b10100110);
myFirstBox[380].setConnections(0b00100110); myFirstBox[380].setConnections(0b00100110);
myFirstBox[381].setConnections(0b01101001); myFirstBox[381].setConnections(0b01101001);
myFirstBox[382].setConnections(0b01100101); myFirstBox[382].setConnections(0b01100101);
myFirstBox[383].setConnections(0b10010101); myFirstBox[383].setConnections(0b10010101);
myFirstBox[384].setConnections(0b01101001); myFirstBox[384].setConnections(0b01101001);
myFirstBox[385].setConnections(0b10010110); myFirstBox[385].setConnections(0b10010110);
myFirstBox[386].setConnections(0b10010101); myFirstBox[386].setConnections(0b10010101);
myFirstBox[387].setConnections(0b10101001); myFirstBox[387].setConnections(0b10101001);
myFirstBox[388].setConnections(0b10011001); myFirstBox[388].setConnections(0b10011001);
myFirstBox[389].setConnections(0b01010110); myFirstBox[389].setConnections(0b01010110);
myFirstBox[390].setConnections(0b10100010); myFirstBox[390].setConnections(0b10100010);
myFirstBox[391].setConnections(0b10101001); myFirstBox[391].setConnections(0b10101001);
myFirstBox[392].setConnections(0b01101010); myFirstBox[392].setConnections(0b01101010);
myFirstBox[393].setConnections(0b10101010); myFirstBox[393].setConnections(0b10101010);
myFirstBox[394].setConnections(0b01100110); myFirstBox[394].setConnections(0b01100110);
myFirstBox[395].setConnections(0b01010101); myFirstBox[395].setConnections(0b01010101);
myFirstBox[396].setConnections(0b01101001); myFirstBox[396].setConnections(0b01101001);
myFirstBox[397].setConnections(0b10010101); myFirstBox[397].setConnections(0b10010101);
myFirstBox[398].setConnections(0b10100110); myFirstBox[398].setConnections(0b10100110);
myFirstBox[399].setConnections(0b01101010); myFirstBox[399].setConnections(0b01101010);
return; return;
} }

View File

@ -1,115 +1,115 @@
//Raphael Maenle - 11.11.2017 //Raphael Maenle - 11.11.2017
#include <iostream> #include <iostream>
#include <bitset> #include <bitset>
#include <cstdlib> #include <cstdlib>
#include <time.h> #include <time.h>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#define debug #define debug
#include "puzzle.h" #include "puzzle.h"
#include "test_puzzle.h" #include "test_puzzle.h"
using namespace std; using namespace std;
vector<LogEntry> log; vector<LogEntry> log;
int main() int main()
{ {
srand(time(0)); srand(time(0));
vector<Part> part_array(NR_PARTS); vector<Part> part_array(NR_PARTS);
vector<Part *> corners_array(NR_CORNERS); vector<Part *> corners_array(NR_CORNERS);
vector<Part *> edges_array(NR_EDGES); vector<Part *> edges_array(NR_EDGES);
vector<Part *> inners_array(NR_INNERS); vector<Part *> inners_array(NR_INNERS);
//randomBox myPuzzle(cols,rows); //randomBox myPuzzle(cols,rows);
//myPuzzle.createRandomPuzzle(); //myPuzzle.createRandomPuzzle();
unsigned int rows=20, cols=20; unsigned int rows=20, cols=20;
vector<PuzzlePiece> myFirstBox = createBox(cols, rows); vector<PuzzlePiece> myFirstBox = createBox(cols, rows);
create4040hardBox(myFirstBox); create4040hardBox(myFirstBox);
printBox(myFirstBox); printBox(myFirstBox);
cout << endl; cout << endl;
while(next()); while(next());
return 0; return 0;
} }
next() next()
{ {
//calculates next move according to log //calculates next move according to log
//case puzzle solved //case puzzle solved
//return 0; //return 0;
//case last log empty //case last log empty
//backtrack //backtrack
//case last log exactly one solution //case last log exactly one solution
//put all remaining puzzle pieces into new log entry //put all remaining puzzle pieces into new log entry
//try next piece/place with solve abstraction level 0 //try next piece/place with solve abstraction level 0
//case last log multiple entries //case last log multiple entries
//advance abstraction layer of last log by one and solve() //advance abstraction layer of last log by one and solve()
//or pick first if highest level reached //or pick first if highest level reached
//return 1; //return 1;
} }
solve() solve()
{ {
//case //case
//abstraction layer = 0 //abstraction layer = 0
//go to abstraction layer 0 solver //go to abstraction layer 0 solver
//case //case
//abstraction layer = 1 //abstraction layer = 1
//go to abstraction layer 1 solver //go to abstraction layer 1 solver
//default //default
//random one of the parts //random one of the parts
} }
abstractionlayer0solver() abstractionlayer0solver()
{ {
//throw all remaining puzzle pieces into log //throw all remaining puzzle pieces into log
//remove all impossible //remove all impossible
} }
abstractionlayer1solver() abstractionlayer1solver()
{ {
//remove all impossible according to abstraction layer one //remove all impossible according to abstraction layer one
} }
setsolution() setsolution()
{ {
//put //put
//set pointer to log into matrix //set pointer to log into matrix
} }
backtrack() backtrack()
{ {
//following possibilities: //following possibilities:
//last log entry empty //last log entry empty
//delete last log + backtrack //delete last log + backtrack
//last log entry only one solution //last log entry only one solution
//delete last log + backtrack //delete last log + backtrack
//last log entry multiple solutions (and current one was randomed) //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) //delete randomed piece from puzzleCollector and go to next (which might random again depending on function)
} }

View File

@ -1,467 +1,467 @@
#include <stdint.h> #include <stdint.h>
#define NR_PARTS 1008 #define NR_PARTS 1008
#define NR_CORNERS 4 #define NR_CORNERS 4
#define NR_EDGES 120 #define NR_EDGES 120
#define NR_INNERS 884 #define NR_INNERS 884
using namespace std; using namespace std;
//part from group header file //part from group header file
class Part class Part
{ {
public: public:
Part(): connections(0){} Part(): connections(0){}
~Part() {} ~Part() {}
uint8_t getConnections() const uint8_t getConnections() const
{ {
return connections; return connections;
} }
void setConnections(uint8_t newconnections) void setConnections(uint8_t newconnections)
{ {
connections = newconnections; connections = newconnections;
} }
private: private:
uint8_t connections; uint8_t connections;
}; };
//puzzlepiece extens part with essential identifiers and functions //puzzlepiece extens part with essential identifiers and functions
class PuzzlePiece: public Part class PuzzlePiece: public Part
{ {
public: public:
PuzzlePiece(unsigned int flag = 0) PuzzlePiece(unsigned int flag = 0)
{ {
shifts=0; shifts=0;
boxidentifier=-1; boxidentifier=-1;
switch(flag) switch(flag)
{ {
case 0: case 0:
setConnections(0b00000000); setConnections(0b00000000);
break; break;
case 1: case 1:
setConnections(0b11111111); setConnections(0b11111111);
break; break;
case 3: case 3:
randomCenterPiece(); randomCenterPiece();
break; break;
} }
} }
void shift(unsigned int moves); void shift(unsigned int moves);
void randomCenterPiece(); void randomCenterPiece();
void printPiece() { cout << bitset<sizeof(unsigned char)*8> (getConnections()); } void printPiece() { cout << bitset<sizeof(unsigned char)*8> (getConnections()); }
void setBoxIdentifier(int new_boxid) { boxidentifier = new_boxid; } void setBoxIdentifier(int new_boxid) { boxidentifier = new_boxid; }
int getBoxIdentifier() { return boxidentifier; } int getBoxIdentifier() { return boxidentifier; }
void assignIdentifier() { identifier = idcount;idcount++; } void assignIdentifier() { identifier = idcount;idcount++; }
unsigned int getIdentifier() { return identifier;} unsigned int getIdentifier() { return identifier;}
private: private:
unsigned int shifts; unsigned int shifts;
unsigned int boxidentifier; unsigned int boxidentifier;
unsigned int identifier; unsigned int identifier;
static unsigned int idcount; static unsigned int idcount;
}; };
unsigned int PuzzlePiece::idcount(0); unsigned int PuzzlePiece::idcount(0);
class Puzzle class Puzzle
{ {
friend class randomBox; friend class randomBox;
public: public:
//constructor creates matrix with 00 outside and 11 inside //constructor creates matrix with 00 outside and 11 inside
Puzzle(uint m = 7, uint n = 4): col(m), row(n) Puzzle(uint m = 7, uint n = 4): col(m), row(n)
{ {
Matrix = new PuzzlePiece* [n+2]; Matrix = new PuzzlePiece* [n+2];
for(int i = 0;i<n+2;i++) for(int i = 0;i<n+2;i++)
{ {
Matrix[i] = new PuzzlePiece[m+2]; Matrix[i] = new PuzzlePiece[m+2];
for(int j = 0;j<m+2;j++) for(int j = 0;j<m+2;j++)
{ {
if(i==0 || j==0 || i==n+1 || j==m+1) if(i==0 || j==0 || i==n+1 || j==m+1)
{ {
Matrix[i][j] = PuzzlePiece(0); Matrix[i][j] = PuzzlePiece(0);
} }
else else
{ {
Matrix[i][j] = PuzzlePiece(1); Matrix[i][j] = PuzzlePiece(1);
} }
} }
} }
} }
bool setPiece(uint m,uint n,PuzzlePiece newPiece) bool setPiece(uint m,uint n,PuzzlePiece newPiece)
{ {
if(PlaceOfPartGood(m,n,newPiece)) if(PlaceOfPartGood(m,n,newPiece))
{ {
Matrix[n+1][m+1] = newPiece; Matrix[n+1][m+1] = newPiece;
return 1; return 1;
} }
return 0; return 0;
} }
//removes piece and instead puts undefined piece //removes piece and instead puts undefined piece
bool removePiece(uint m,uint n) bool removePiece(uint m,uint n)
{ {
Matrix[n+1][m+1].setConnections(0b11111111); Matrix[n+1][m+1].setConnections(0b11111111);
return 1; return 1;
} }
//getter //getter
PuzzlePiece getPiece(uint m,uint n) { return Matrix[n+1][m+1]; } PuzzlePiece getPiece(uint m,uint n) { return Matrix[n+1][m+1]; }
uint getCols(){ return col; } uint getCols(){ return col; }
uint getRows(){ return row; } uint getRows(){ return row; }
//functtion definitions //functtion definitions
void printPuzzle(); void printPuzzle();
bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart); bool PlaceOfPartGood(unsigned int m, unsigned int n, PuzzlePiece& myPart);
bool PlaceOfPart2Good(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); 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 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); unsigned int putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox);
private: private:
uint row; uint row;
uint col; uint col;
PuzzlePiece** Matrix; PuzzlePiece** Matrix;
}; };
//use this for random puzzle creation //use this for random puzzle creation
class randomBox: public Puzzle class randomBox: public Puzzle
{ {
public: public:
randomBox(unsigned int m, unsigned int n) : Puzzle(m,n) {} //passed m n to puzzle constructor randomBox(unsigned int m, unsigned int n) : Puzzle(m,n) {} //passed m n to puzzle constructor
void createRandomPuzzle(); void createRandomPuzzle();
vector<PuzzlePiece> shuffle(); vector<PuzzlePiece> shuffle();
void printBox(); void printBox();
private: private:
vector<PuzzlePiece*> Box; vector<PuzzlePiece*> Box;
}; };
class coor class coor
{ {
int m, n; int m, n;
coor(int newm,int newn): m(newm), n(newn) coor(int newm,int newn): m(newm), n(newn)
{} {}
} }
class LogEntry class LogEntry
{ {
public: public:
vector<PuzzlePiece*> PieceCollector; vector<PuzzlePiece*> PieceCollector;
vector<coor> CoorCollector; vector<coor> CoorCollector;
int abstractionLevel; int abstractionLevel;
uint myCoor; uint myCoor;
PuzzlePiece* myPuzzlePiece; PuzzlePiece* myPuzzlePiece;
PuzzleCollector() PuzzleCollector()
{ {
myCoor.m=-1; myCoor.m=-1;
myCoor.n=-1; myCoor.n=-1;
abstractionLevel=0; abstractionLevel=0;
} }
private: private:
} }
//functiondefinitions //functiondefinitions
void printBox(vector<PuzzlePiece> myBox); void printBox(vector<PuzzlePiece> myBox);
vector<PuzzlePiece> createBox(uint m, uint n); vector<PuzzlePiece> createBox(uint m, uint n);
void numerateBox(vector<PuzzlePiece>& myBox); void numerateBox(vector<PuzzlePiece>& myBox);
//functions //functions
//shifts puzzle piece one to the right //shifts puzzle piece one to the right
void PuzzlePiece::shift(unsigned int moves) void PuzzlePiece::shift(unsigned int moves)
{ {
shifts = (shifts+moves)%4; shifts = (shifts+moves)%4;
setConnections(((getConnections() >> (moves*2)) | (getConnections() << sizeof(unsigned char)*8 - (moves*2)))); setConnections(((getConnections() >> (moves*2)) | (getConnections() << sizeof(unsigned char)*8 - (moves*2))));
} }
//creates random centerpiece //creates random centerpiece
void PuzzlePiece::randomCenterPiece() void PuzzlePiece::randomCenterPiece()
{ {
setConnections(0b00000000); setConnections(0b00000000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b01000000); setConnections(getConnections() | 0b01000000);
else else
setConnections(getConnections() | 0b10000000); setConnections(getConnections() | 0b10000000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b00010000); setConnections(getConnections() | 0b00010000);
else else
setConnections(getConnections() | 0b00100000); setConnections(getConnections() | 0b00100000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b00000100); setConnections(getConnections() | 0b00000100);
else else
setConnections(getConnections() | 0b00001000); setConnections(getConnections() | 0b00001000);
if(rand()%2) if(rand()%2)
setConnections(getConnections() | 0b00000001); setConnections(getConnections() | 0b00000001);
else else
setConnections(getConnections() | 0b00000010); setConnections(getConnections() | 0b00000010);
} }
//tries all pieces in box from separator to end and places fitting into matrix. removes fitting piece //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 //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. //seperator may be bigger than box size, if all puzzle pieces have already been looked at.
// it immediately retracts again then (returns -1) // it immediately retracts again then (returns -1)
unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox, unsigned int separator) unsigned int Puzzle::tryAllPieces(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox, unsigned int separator)
{ {
for(int i=separator; i<myBox.size();i++) for(int i=separator; i<myBox.size();i++)
{ {
if(testRotationPiece(m,n,myBox[i])) if(testRotationPiece(m,n,myBox[i]))
{ {
setPiece(m,n,myBox[i]); setPiece(m,n,myBox[i]);
myBox.erase(myBox.begin()+i); myBox.erase(myBox.begin()+i);
return i; return i;
} }
} }
return -1; return -1;
} }
//tests the myPart in all 4 rotations at position m, n //tests the myPart in all 4 rotations at position m, n
bool Puzzle::testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart) bool Puzzle::testRotationPiece(unsigned int m, unsigned int n, PuzzlePiece& myPart)
{ {
for(int rotation=0; rotation < 4; rotation++) for(int rotation=0; rotation < 4; rotation++)
{ {
if(PlaceOfPartGood(m,n, myPart)) if(PlaceOfPartGood(m,n, myPart))
return 1; return 1;
myPart.shift(1); myPart.shift(1);
} }
#ifdef debug #ifdef debug
cout << "bad part: "; cout << "bad part: ";
myPart.printPiece(); myPart.printPiece();
cout << endl; cout << endl;
#endif #endif
return 0; return 0;
} }
//insterts piece at position in box according to boxidentifier and removes piece from puzzle //insterts piece at position in box according to boxidentifier and removes piece from puzzle
//this returns the position after!! the puzzle piece was put back in! not the boxidentifier of the piece. look that up in other function. //this returns the position after!! the puzzle piece was put back in! not the boxidentifier of the piece. look that up in other function.
unsigned int Puzzle::putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox) unsigned int Puzzle::putBackIntoBox(unsigned int m, unsigned int n, vector<PuzzlePiece>& myBox)
{ {
#ifdef debug #ifdef debug
cout << "putting back" << endl; cout << "putting back" << endl;
cout << "Old Box: "; cout << "Old Box: ";
printBox(myBox); printBox(myBox);
cout << endl; cout << endl;
#endif #endif
for(int i = 0; i < myBox.size();i++) for(int i = 0; i < myBox.size();i++)
{ {
if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier()) if(myBox[i].getBoxIdentifier()>getPiece(m,n).getBoxIdentifier())
{ {
myBox.insert(myBox.begin()+i,getPiece(m,n)); myBox.insert(myBox.begin()+i,getPiece(m,n));
removePiece(m,n); removePiece(m,n);
return i+1; return i+1;
} }
} }
//using push back, if the element was the last element in the vector chain //using push back, if the element was the last element in the vector chain
myBox.push_back(getPiece(m,n)); myBox.push_back(getPiece(m,n));
removePiece(m,n); removePiece(m,n);
return myBox.size(); return myBox.size();
} }
//checks if the myPart in its current orientation is legal in position m, n //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) bool Puzzle::PlaceOfPartGood(unsigned int m,unsigned int n, PuzzlePiece& myPart)
{ {
PuzzlePiece negativePart(0); PuzzlePiece negativePart(0);
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); 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-1,n).getConnections() & 0b00110000));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011));
negativePart.shift(2); negativePart.shift(2);
if ( if (
( ((((negativePart.getConnections() & 0b11000000) ^ (myPart.getConnections() & 0b11000000)) != 0b00000000) && (((myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000)) ( ((((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) == 0b11000000) || ((myPart.getConnections() & 0b11000000) == 0b11000000)) && (( myPart.getConnections() & 0b11000000) != 0b00000000) && (negativePart.getConnections() & 0b11000000) != 0b00000000)
|| (((negativePart.getConnections() & 0b11000000) == 0b00000000) && ((myPart.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) ^ (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) == 0b00110000) || ((myPart.getConnections() & 0b00110000) == 0b00110000)) && (((myPart.getConnections() & 0b00110000) != 0b00000000) && (negativePart.getConnections() & 0b00110000) != 0b00000000))
|| (((negativePart.getConnections() & 0b00110000) == 0b00000000) && ((myPart.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) ^ (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) == 0b00001100) || ((myPart.getConnections() & 0b00001100) == 0b00001100)) && (((myPart.getConnections() & 0b00001100) != 0b00000000) && (negativePart.getConnections() & 0b00001100) != 0b00000000))
|| (((negativePart.getConnections() & 0b00001100) == 0b00000000) && ((myPart.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) ^ (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) == 0b00000011) || ((myPart.getConnections() & 0b00000011) == 0b00000011)) && (((myPart.getConnections() & 0b00000011) != 0b00000000) && (negativePart.getConnections() & 0b00000011) != 0b00000000))
|| (((negativePart.getConnections() & 0b00000011) == 0b00000000) && ((myPart.getConnections() & 0b00000011) == 0b00000000)) ) || (((negativePart.getConnections() & 0b00000011) == 0b00000000) && ((myPart.getConnections() & 0b00000011) == 0b00000000)) )
) )
{ {
#ifdef debug #ifdef debug
cout << "good Part: "; cout << "good Part: ";
myPart.printPiece(); myPart.printPiece();
cout << endl; cout << endl;
#endif #endif
return 1; return 1;
} }
return 0; return 0;
} }
//TODO!! //TODO!!
//simpler algorithm to the first placeofpartgood //simpler algorithm to the first placeofpartgood
//not yet functional!!! //not yet functional!!!
bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart) bool Puzzle::PlaceOfPart2Good(unsigned int m,unsigned int n, PuzzlePiece& myPart)
{ {
PuzzlePiece negativePart(0); PuzzlePiece negativePart(0);
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n+1).getConnections() & 0b11000000)); 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-1,n).getConnections() & 0b00110000));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m,n-1).getConnections() & 0b00001100));
negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011)); negativePart.setConnections(negativePart.getConnections() | (getPiece(m+1,n).getConnections() & 0b00000011));
negativePart.shift(2); negativePart.shift(2);
//A and D or B and C or not A and not B and not C and not D //A and D or B and C or not A and not B and not C and not D
if ( if (
( ( (negativePart.getConnections() & 0b10000000) & (myPart.getConnections() & 0b01000000)) ( ( (negativePart.getConnections() & 0b10000000) & (myPart.getConnections() & 0b01000000))
|| ( (negativePart.getConnections() & 0b01000000) & (myPart.getConnections() & 0b10000000)) || ( (negativePart.getConnections() & 0b01000000) & (myPart.getConnections() & 0b10000000))
|| ((!(negativePart.getConnections() & 0b10000000) & !(myPart.getConnections() & 0b10000000)) & (!(negativePart.getConnections() & 0b01000000) & !(myPart.getConnections() & 0b01000000))) || ((!(negativePart.getConnections() & 0b10000000) & !(myPart.getConnections() & 0b10000000)) & (!(negativePart.getConnections() & 0b01000000) & !(myPart.getConnections() & 0b01000000)))
) )
&& &&
( ( (negativePart.getConnections() & 0b00100000) & (myPart.getConnections() & 0b00010000)) ( ( (negativePart.getConnections() & 0b00100000) & (myPart.getConnections() & 0b00010000))
|| ( (negativePart.getConnections() & 0b00010000) & (myPart.getConnections() & 0b00100000)) || ( (negativePart.getConnections() & 0b00010000) & (myPart.getConnections() & 0b00100000))
|| ((!(negativePart.getConnections() & 0b00100000) & !(myPart.getConnections() & 0b00100000)) & (!(negativePart.getConnections() & 0b00010000) & !(myPart.getConnections() & 0b00010000))) || ((!(negativePart.getConnections() & 0b00100000) & !(myPart.getConnections() & 0b00100000)) & (!(negativePart.getConnections() & 0b00010000) & !(myPart.getConnections() & 0b00010000)))
) )
&& &&
( ( (negativePart.getConnections() & 0b00001000) & (myPart.getConnections() & 0b00000100)) ( ( (negativePart.getConnections() & 0b00001000) & (myPart.getConnections() & 0b00000100))
|| ( (negativePart.getConnections() & 0b00000100) & (myPart.getConnections() & 0b00001000)) || ( (negativePart.getConnections() & 0b00000100) & (myPart.getConnections() & 0b00001000))
|| ((!(negativePart.getConnections() & 0b00001000) & !(myPart.getConnections() & 0b00001000)) & (!(negativePart.getConnections() & 0b00000100) & !(myPart.getConnections() & 0b00000100))) || ((!(negativePart.getConnections() & 0b00001000) & !(myPart.getConnections() & 0b00001000)) & (!(negativePart.getConnections() & 0b00000100) & !(myPart.getConnections() & 0b00000100)))
) )
&& &&
( ( (negativePart.getConnections() & 0b00000010) & (myPart.getConnections() & 0b00000001)) ( ( (negativePart.getConnections() & 0b00000010) & (myPart.getConnections() & 0b00000001))
|| ( (negativePart.getConnections() & 0b00000001) & (myPart.getConnections() & 0b00000010)) || ( (negativePart.getConnections() & 0b00000001) & (myPart.getConnections() & 0b00000010))
|| ((!(negativePart.getConnections() & 0b00000010) & !(myPart.getConnections() & 0b00000010)) & (!(negativePart.getConnections() & 0b00000001) & !(myPart.getConnections() & 0b00000001))) || ((!(negativePart.getConnections() & 0b00000010) & !(myPart.getConnections() & 0b00000010)) & (!(negativePart.getConnections() & 0b00000001) & !(myPart.getConnections() & 0b00000001)))
) )
) )
return 1; return 1;
cout << "nogood" << endl; cout << "nogood" << endl;
return 0; return 0;
} }
//prints the true puzzle (without 0 edges) //prints the true puzzle (without 0 edges)
void Puzzle::printPuzzle() void Puzzle::printPuzzle()
{ {
cout << "current Puzzle: " << endl; cout << "current Puzzle: " << endl;
for(int i=1;i<row+1;i++) for(int i=1;i<row+1;i++)
{ {
for(int j=1;j<col+1;j++) for(int j=1;j<col+1;j++)
{ {
Matrix[i][j].printPiece(); Matrix[i][j].printPiece();
cout << " "; cout << " ";
} }
cout << endl; cout << endl;
} }
cout << endl; cout << endl;
} }
//creates a legal puzzle out of random pieces //creates a legal puzzle out of random pieces
void randomBox::createRandomPuzzle() void randomBox::createRandomPuzzle()
{ {
PuzzlePiece temporaryRandomPiece(0); PuzzlePiece temporaryRandomPiece(0);
for(int i=0;i<getRows();i++) for(int i=0;i<getRows();i++)
{ {
for(int j = 0; j < getCols();) for(int j = 0; j < getCols();)
{ {
//create random piece, set edges according to position and check if piece is good //create random piece, set edges according to position and check if piece is good
temporaryRandomPiece.randomCenterPiece(); temporaryRandomPiece.randomCenterPiece();
if(i==0) if(i==0)
temporaryRandomPiece.setConnections(0b00111111 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b00111111 & temporaryRandomPiece.getConnections());
if(i==getRows()-1) if(i==getRows()-1)
temporaryRandomPiece.setConnections(0b11110011 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b11110011 & temporaryRandomPiece.getConnections());
if(j==0) if(j==0)
temporaryRandomPiece.setConnections(0b11111100 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b11111100 & temporaryRandomPiece.getConnections());
if(j==getCols()-1) if(j==getCols()-1)
temporaryRandomPiece.setConnections(0b11001111 & temporaryRandomPiece.getConnections()); temporaryRandomPiece.setConnections(0b11001111 & temporaryRandomPiece.getConnections());
if(PlaceOfPartGood(j,i,temporaryRandomPiece)) if(PlaceOfPartGood(j,i,temporaryRandomPiece))
{ {
temporaryRandomPiece.assignIdentifier(); temporaryRandomPiece.assignIdentifier();
setPiece(j,i,temporaryRandomPiece); setPiece(j,i,temporaryRandomPiece);
j++; j++;
Box.push_back(temporaryRandomPiece); Box.push_back(temporaryRandomPiece);
} }
} }
} }
} }
//prints a box contents on console //prints a box contents on console
void randomBox::printBox() void randomBox::printBox()
{ {
shuffle(); shuffle();
for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++) for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++)
{ {
(*i).printPiece(); (*i).printPiece();
cout << ' '; cout << ' ';
} }
cout << endl; cout << endl;
} }
//shuffles around a box, randomizing pieces and orientation //shuffles around a box, randomizing pieces and orientation
vector<PuzzlePiece> randomBox::shuffle() vector<PuzzlePiece> randomBox::shuffle()
{ {
random_shuffle(Box.begin(),Box.end()); random_shuffle(Box.begin(),Box.end());
for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++) for (vector<PuzzlePiece>::iterator i = Box.begin(); i != Box.end(); i++)
(*i).shift(rand()%4); (*i).shift(rand()%4);
numerateBox(Box); numerateBox(Box);
return Box; return Box;
} }
//creates a random box size m, n, shuffles it, and then retuns it //creates a random box size m, n, shuffles it, and then retuns it
vector<PuzzlePiece> createBox(uint m, uint n) vector<PuzzlePiece> createBox(uint m, uint n)
{ {
randomBox myFirstPuzzleBox(m,n); randomBox myFirstPuzzleBox(m,n);
myFirstPuzzleBox.createRandomPuzzle(); myFirstPuzzleBox.createRandomPuzzle();
return myFirstPuzzleBox.shuffle(); return myFirstPuzzleBox.shuffle();
} }
//prints contents of box //prints contents of box
void printBox(vector<PuzzlePiece> myBox) void printBox(vector<PuzzlePiece> myBox)
{ {
cout << "current Box: " << endl; cout << "current Box: " << endl;
for (vector<PuzzlePiece>::iterator i = myBox.begin(); i != myBox.end(); i++) for (vector<PuzzlePiece>::iterator i = myBox.begin(); i != myBox.end(); i++)
{ {
(*i).printPiece(); (*i).printPiece();
cout << ' '; cout << ' ';
} }
cout << endl; cout << endl;
return; return;
} }
//gives every element in box a box identifier. //gives every element in box a box identifier.
void numerateBox(vector<PuzzlePiece>& myBox) void numerateBox(vector<PuzzlePiece>& myBox)
{ {
for(int i = 0; i< myBox.size();i++) for(int i = 0; i< myBox.size();i++)
myBox[i].setBoxIdentifier(i); myBox[i].setBoxIdentifier(i);
return; return;
} }

View File

@ -1,406 +1,406 @@
void create4040hardBox(vector<PuzzlePiece>& myFirstBox) void create4040hardBox(vector<PuzzlePiece>& myFirstBox)
{ {
myFirstBox[0].setConnections(0b01101001); myFirstBox[0].setConnections(0b01101001);
myFirstBox[1].setConnections(0b10011001); myFirstBox[1].setConnections(0b10011001);
myFirstBox[2].setConnections(0b01100110); myFirstBox[2].setConnections(0b01100110);
myFirstBox[3].setConnections(0b01101001); myFirstBox[3].setConnections(0b01101001);
myFirstBox[4].setConnections(0b10100101); myFirstBox[4].setConnections(0b10100101);
myFirstBox[5].setConnections(0b10010010); myFirstBox[5].setConnections(0b10010010);
myFirstBox[6].setConnections(0b01101001); myFirstBox[6].setConnections(0b01101001);
myFirstBox[7].setConnections(0b00101010); myFirstBox[7].setConnections(0b00101010);
myFirstBox[8].setConnections(0b01000110); myFirstBox[8].setConnections(0b01000110);
myFirstBox[9].setConnections(0b01011010); myFirstBox[9].setConnections(0b01011010);
myFirstBox[10].setConnections(0b01011010); myFirstBox[10].setConnections(0b01011010);
myFirstBox[11].setConnections(0b10010101); myFirstBox[11].setConnections(0b10010101);
myFirstBox[12].setConnections(0b01010101); myFirstBox[12].setConnections(0b01010101);
myFirstBox[13].setConnections(0b10101001); myFirstBox[13].setConnections(0b10101001);
myFirstBox[14].setConnections(0b10010101); myFirstBox[14].setConnections(0b10010101);
myFirstBox[15].setConnections(0b10101010); myFirstBox[15].setConnections(0b10101010);
myFirstBox[16].setConnections(0b01101010); myFirstBox[16].setConnections(0b01101010);
myFirstBox[17].setConnections(0b01101010); myFirstBox[17].setConnections(0b01101010);
myFirstBox[18].setConnections(0b00100101); myFirstBox[18].setConnections(0b00100101);
myFirstBox[19].setConnections(0b01100101); myFirstBox[19].setConnections(0b01100101);
myFirstBox[20].setConnections(0b10010001); myFirstBox[20].setConnections(0b10010001);
myFirstBox[21].setConnections(0b10010101); myFirstBox[21].setConnections(0b10010101);
myFirstBox[22].setConnections(0b10101001); myFirstBox[22].setConnections(0b10101001);
myFirstBox[23].setConnections(0b01010110); myFirstBox[23].setConnections(0b01010110);
myFirstBox[24].setConnections(0b10101010); myFirstBox[24].setConnections(0b10101010);
myFirstBox[25].setConnections(0b01101000); myFirstBox[25].setConnections(0b01101000);
myFirstBox[26].setConnections(0b01101010); myFirstBox[26].setConnections(0b01101010);
myFirstBox[27].setConnections(0b10010101); myFirstBox[27].setConnections(0b10010101);
myFirstBox[28].setConnections(0b10011010); myFirstBox[28].setConnections(0b10011010);
myFirstBox[29].setConnections(0b10011001); myFirstBox[29].setConnections(0b10011001);
myFirstBox[30].setConnections(0b01101010); myFirstBox[30].setConnections(0b01101010);
myFirstBox[31].setConnections(0b01100001); myFirstBox[31].setConnections(0b01100001);
myFirstBox[32].setConnections(0b01101010); myFirstBox[32].setConnections(0b01101010);
myFirstBox[33].setConnections(0b01100101); myFirstBox[33].setConnections(0b01100101);
myFirstBox[34].setConnections(0b01010101); myFirstBox[34].setConnections(0b01010101);
myFirstBox[35].setConnections(0b01010110); myFirstBox[35].setConnections(0b01010110);
myFirstBox[36].setConnections(0b01101010); myFirstBox[36].setConnections(0b01101010);
myFirstBox[37].setConnections(0b01010110); myFirstBox[37].setConnections(0b01010110);
myFirstBox[38].setConnections(0b01100110); myFirstBox[38].setConnections(0b01100110);
myFirstBox[39].setConnections(0b01011010); myFirstBox[39].setConnections(0b01011010);
myFirstBox[40].setConnections(0b01100101); myFirstBox[40].setConnections(0b01100101);
myFirstBox[41].setConnections(0b01101001); myFirstBox[41].setConnections(0b01101001);
myFirstBox[42].setConnections(0b01010110); myFirstBox[42].setConnections(0b01010110);
myFirstBox[43].setConnections(0b01000110); myFirstBox[43].setConnections(0b01000110);
myFirstBox[44].setConnections(0b01011001); myFirstBox[44].setConnections(0b01011001);
myFirstBox[45].setConnections(0b01101001); myFirstBox[45].setConnections(0b01101001);
myFirstBox[46].setConnections(0b10000101); myFirstBox[46].setConnections(0b10000101);
myFirstBox[47].setConnections(0b10011010); myFirstBox[47].setConnections(0b10011010);
myFirstBox[48].setConnections(0b10010110); myFirstBox[48].setConnections(0b10010110);
myFirstBox[49].setConnections(0b01011010); myFirstBox[49].setConnections(0b01011010);
myFirstBox[50].setConnections(0b10011001); myFirstBox[50].setConnections(0b10011001);
myFirstBox[51].setConnections(0b01001001); myFirstBox[51].setConnections(0b01001001);
myFirstBox[52].setConnections(0b10100110); myFirstBox[52].setConnections(0b10100110);
myFirstBox[53].setConnections(0b01001010); myFirstBox[53].setConnections(0b01001010);
myFirstBox[54].setConnections(0b10010010); myFirstBox[54].setConnections(0b10010010);
myFirstBox[55].setConnections(0b01001010); myFirstBox[55].setConnections(0b01001010);
myFirstBox[56].setConnections(0b01101001); myFirstBox[56].setConnections(0b01101001);
myFirstBox[57].setConnections(0b10100110); myFirstBox[57].setConnections(0b10100110);
myFirstBox[58].setConnections(0b10010110); myFirstBox[58].setConnections(0b10010110);
myFirstBox[59].setConnections(0b10010110); myFirstBox[59].setConnections(0b10010110);
myFirstBox[60].setConnections(0b10101001); myFirstBox[60].setConnections(0b10101001);
myFirstBox[61].setConnections(0b00100101); myFirstBox[61].setConnections(0b00100101);
myFirstBox[62].setConnections(0b00101001); myFirstBox[62].setConnections(0b00101001);
myFirstBox[63].setConnections(0b01101001); myFirstBox[63].setConnections(0b01101001);
myFirstBox[64].setConnections(0b01101001); myFirstBox[64].setConnections(0b01101001);
myFirstBox[65].setConnections(0b00100101); myFirstBox[65].setConnections(0b00100101);
myFirstBox[66].setConnections(0b10010110); myFirstBox[66].setConnections(0b10010110);
myFirstBox[67].setConnections(0b10011010); myFirstBox[67].setConnections(0b10011010);
myFirstBox[68].setConnections(0b01100110); myFirstBox[68].setConnections(0b01100110);
myFirstBox[69].setConnections(0b10010110); myFirstBox[69].setConnections(0b10010110);
myFirstBox[70].setConnections(0b01010100); myFirstBox[70].setConnections(0b01010100);
myFirstBox[71].setConnections(0b01011010); myFirstBox[71].setConnections(0b01011010);
myFirstBox[72].setConnections(0b01100110); myFirstBox[72].setConnections(0b01100110);
myFirstBox[73].setConnections(0b01100101); myFirstBox[73].setConnections(0b01100101);
myFirstBox[74].setConnections(0b10011010); myFirstBox[74].setConnections(0b10011010);
myFirstBox[75].setConnections(0b10010101); myFirstBox[75].setConnections(0b10010101);
myFirstBox[76].setConnections(0b10011010); myFirstBox[76].setConnections(0b10011010);
myFirstBox[77].setConnections(0b01100101); myFirstBox[77].setConnections(0b01100101);
myFirstBox[78].setConnections(0b10011010); myFirstBox[78].setConnections(0b10011010);
myFirstBox[79].setConnections(0b01010110); myFirstBox[79].setConnections(0b01010110);
myFirstBox[80].setConnections(0b01101010); myFirstBox[80].setConnections(0b01101010);
myFirstBox[81].setConnections(0b01010101); myFirstBox[81].setConnections(0b01010101);
myFirstBox[82].setConnections(0b01100101); myFirstBox[82].setConnections(0b01100101);
myFirstBox[83].setConnections(0b10100101); myFirstBox[83].setConnections(0b10100101);
myFirstBox[84].setConnections(0b01010110); myFirstBox[84].setConnections(0b01010110);
myFirstBox[85].setConnections(0b01101010); myFirstBox[85].setConnections(0b01101010);
myFirstBox[86].setConnections(0b10011010); myFirstBox[86].setConnections(0b10011010);
myFirstBox[87].setConnections(0b10010110); myFirstBox[87].setConnections(0b10010110);
myFirstBox[88].setConnections(0b01101010); myFirstBox[88].setConnections(0b01101010);
myFirstBox[89].setConnections(0b01011010); myFirstBox[89].setConnections(0b01011010);
myFirstBox[90].setConnections(0b01010110); myFirstBox[90].setConnections(0b01010110);
myFirstBox[91].setConnections(0b01100101); myFirstBox[91].setConnections(0b01100101);
myFirstBox[92].setConnections(0b00100101); myFirstBox[92].setConnections(0b00100101);
myFirstBox[93].setConnections(0b10100101); myFirstBox[93].setConnections(0b10100101);
myFirstBox[94].setConnections(0b10010110); myFirstBox[94].setConnections(0b10010110);
myFirstBox[95].setConnections(0b01100110); myFirstBox[95].setConnections(0b01100110);
myFirstBox[96].setConnections(0b10000110); myFirstBox[96].setConnections(0b10000110);
myFirstBox[97].setConnections(0b01001001); myFirstBox[97].setConnections(0b01001001);
myFirstBox[98].setConnections(0b10010110); myFirstBox[98].setConnections(0b10010110);
myFirstBox[99].setConnections(0b10100110); myFirstBox[99].setConnections(0b10100110);
myFirstBox[100].setConnections(0b10100110); myFirstBox[100].setConnections(0b10100110);
myFirstBox[101].setConnections(0b01100010); myFirstBox[101].setConnections(0b01100010);
myFirstBox[102].setConnections(0b01101010); myFirstBox[102].setConnections(0b01101010);
myFirstBox[103].setConnections(0b10011001); myFirstBox[103].setConnections(0b10011001);
myFirstBox[104].setConnections(0b01010101); myFirstBox[104].setConnections(0b01010101);
myFirstBox[105].setConnections(0b10011010); myFirstBox[105].setConnections(0b10011010);
myFirstBox[106].setConnections(0b10101001); myFirstBox[106].setConnections(0b10101001);
myFirstBox[107].setConnections(0b01100110); myFirstBox[107].setConnections(0b01100110);
myFirstBox[108].setConnections(0b10101001); myFirstBox[108].setConnections(0b10101001);
myFirstBox[109].setConnections(0b10101001); myFirstBox[109].setConnections(0b10101001);
myFirstBox[110].setConnections(0b10010100); myFirstBox[110].setConnections(0b10010100);
myFirstBox[111].setConnections(0b01100110); myFirstBox[111].setConnections(0b01100110);
myFirstBox[112].setConnections(0b01010110); myFirstBox[112].setConnections(0b01010110);
myFirstBox[113].setConnections(0b10010101); myFirstBox[113].setConnections(0b10010101);
myFirstBox[114].setConnections(0b01011001); myFirstBox[114].setConnections(0b01011001);
myFirstBox[115].setConnections(0b01101010); myFirstBox[115].setConnections(0b01101010);
myFirstBox[116].setConnections(0b10100110); myFirstBox[116].setConnections(0b10100110);
myFirstBox[117].setConnections(0b10100101); myFirstBox[117].setConnections(0b10100101);
myFirstBox[118].setConnections(0b10101010); myFirstBox[118].setConnections(0b10101010);
myFirstBox[119].setConnections(0b01011010); myFirstBox[119].setConnections(0b01011010);
myFirstBox[120].setConnections(0b10011000); myFirstBox[120].setConnections(0b10011000);
myFirstBox[121].setConnections(0b10010101); myFirstBox[121].setConnections(0b10010101);
myFirstBox[122].setConnections(0b10100101); myFirstBox[122].setConnections(0b10100101);
myFirstBox[123].setConnections(0b10000110); myFirstBox[123].setConnections(0b10000110);
myFirstBox[124].setConnections(0b01100101); myFirstBox[124].setConnections(0b01100101);
myFirstBox[125].setConnections(0b10100110); myFirstBox[125].setConnections(0b10100110);
myFirstBox[126].setConnections(0b10101010); myFirstBox[126].setConnections(0b10101010);
myFirstBox[127].setConnections(0b01101001); myFirstBox[127].setConnections(0b01101001);
myFirstBox[128].setConnections(0b01010101); myFirstBox[128].setConnections(0b01010101);
myFirstBox[129].setConnections(0b01100101); myFirstBox[129].setConnections(0b01100101);
myFirstBox[130].setConnections(0b10001001); myFirstBox[130].setConnections(0b10001001);
myFirstBox[131].setConnections(0b01101010); myFirstBox[131].setConnections(0b01101010);
myFirstBox[132].setConnections(0b01101010); myFirstBox[132].setConnections(0b01101010);
myFirstBox[133].setConnections(0b01100010); myFirstBox[133].setConnections(0b01100010);
myFirstBox[134].setConnections(0b01100110); myFirstBox[134].setConnections(0b01100110);
myFirstBox[135].setConnections(0b10100001); myFirstBox[135].setConnections(0b10100001);
myFirstBox[136].setConnections(0b10011001); myFirstBox[136].setConnections(0b10011001);
myFirstBox[137].setConnections(0b01101010); myFirstBox[137].setConnections(0b01101010);
myFirstBox[138].setConnections(0b01011001); myFirstBox[138].setConnections(0b01011001);
myFirstBox[139].setConnections(0b10001001); myFirstBox[139].setConnections(0b10001001);
myFirstBox[140].setConnections(0b01010101); myFirstBox[140].setConnections(0b01010101);
myFirstBox[141].setConnections(0b10100101); myFirstBox[141].setConnections(0b10100101);
myFirstBox[142].setConnections(0b01100101); myFirstBox[142].setConnections(0b01100101);
myFirstBox[143].setConnections(0b10100101); myFirstBox[143].setConnections(0b10100101);
myFirstBox[144].setConnections(0b10011010); myFirstBox[144].setConnections(0b10011010);
myFirstBox[145].setConnections(0b10010001); myFirstBox[145].setConnections(0b10010001);
myFirstBox[146].setConnections(0b10100110); myFirstBox[146].setConnections(0b10100110);
myFirstBox[147].setConnections(0b01101010); myFirstBox[147].setConnections(0b01101010);
myFirstBox[148].setConnections(0b10010101); myFirstBox[148].setConnections(0b10010101);
myFirstBox[149].setConnections(0b01100101); myFirstBox[149].setConnections(0b01100101);
myFirstBox[150].setConnections(0b10100101); myFirstBox[150].setConnections(0b10100101);
myFirstBox[151].setConnections(0b10100110); myFirstBox[151].setConnections(0b10100110);
myFirstBox[152].setConnections(0b10010001); myFirstBox[152].setConnections(0b10010001);
myFirstBox[153].setConnections(0b10101000); myFirstBox[153].setConnections(0b10101000);
myFirstBox[154].setConnections(0b10011010); myFirstBox[154].setConnections(0b10011010);
myFirstBox[155].setConnections(0b10100110); myFirstBox[155].setConnections(0b10100110);
myFirstBox[156].setConnections(0b01100110); myFirstBox[156].setConnections(0b01100110);
myFirstBox[157].setConnections(0b10100110); myFirstBox[157].setConnections(0b10100110);
myFirstBox[158].setConnections(0b01011010); myFirstBox[158].setConnections(0b01011010);
myFirstBox[159].setConnections(0b10100001); myFirstBox[159].setConnections(0b10100001);
myFirstBox[160].setConnections(0b01010101); myFirstBox[160].setConnections(0b01010101);
myFirstBox[161].setConnections(0b10011010); myFirstBox[161].setConnections(0b10011010);
myFirstBox[162].setConnections(0b10101001); myFirstBox[162].setConnections(0b10101001);
myFirstBox[163].setConnections(0b01010110); myFirstBox[163].setConnections(0b01010110);
myFirstBox[164].setConnections(0b01100001); myFirstBox[164].setConnections(0b01100001);
myFirstBox[165].setConnections(0b01011001); myFirstBox[165].setConnections(0b01011001);
myFirstBox[166].setConnections(0b01101001); myFirstBox[166].setConnections(0b01101001);
myFirstBox[167].setConnections(0b10011001); myFirstBox[167].setConnections(0b10011001);
myFirstBox[168].setConnections(0b10010101); myFirstBox[168].setConnections(0b10010101);
myFirstBox[169].setConnections(0b01100010); myFirstBox[169].setConnections(0b01100010);
myFirstBox[170].setConnections(0b01010110); myFirstBox[170].setConnections(0b01010110);
myFirstBox[171].setConnections(0b00010101); myFirstBox[171].setConnections(0b00010101);
myFirstBox[172].setConnections(0b10100101); myFirstBox[172].setConnections(0b10100101);
myFirstBox[173].setConnections(0b10101010); myFirstBox[173].setConnections(0b10101010);
myFirstBox[174].setConnections(0b10011010); myFirstBox[174].setConnections(0b10011010);
myFirstBox[175].setConnections(0b01100101); myFirstBox[175].setConnections(0b01100101);
myFirstBox[176].setConnections(0b10100110); myFirstBox[176].setConnections(0b10100110);
myFirstBox[177].setConnections(0b10101001); myFirstBox[177].setConnections(0b10101001);
myFirstBox[178].setConnections(0b01011010); myFirstBox[178].setConnections(0b01011010);
myFirstBox[179].setConnections(0b01101001); myFirstBox[179].setConnections(0b01101001);
myFirstBox[180].setConnections(0b10010101); myFirstBox[180].setConnections(0b10010101);
myFirstBox[181].setConnections(0b01101010); myFirstBox[181].setConnections(0b01101010);
myFirstBox[182].setConnections(0b10010110); myFirstBox[182].setConnections(0b10010110);
myFirstBox[183].setConnections(0b10010110); myFirstBox[183].setConnections(0b10010110);
myFirstBox[184].setConnections(0b10011001); myFirstBox[184].setConnections(0b10011001);
myFirstBox[185].setConnections(0b10100101); myFirstBox[185].setConnections(0b10100101);
myFirstBox[186].setConnections(0b10010110); myFirstBox[186].setConnections(0b10010110);
myFirstBox[187].setConnections(0b10010110); myFirstBox[187].setConnections(0b10010110);
myFirstBox[188].setConnections(0b10011010); myFirstBox[188].setConnections(0b10011010);
myFirstBox[189].setConnections(0b10010101); myFirstBox[189].setConnections(0b10010101);
myFirstBox[190].setConnections(0b01010001); myFirstBox[190].setConnections(0b01010001);
myFirstBox[191].setConnections(0b01010100); myFirstBox[191].setConnections(0b01010100);
myFirstBox[192].setConnections(0b10101000); myFirstBox[192].setConnections(0b10101000);
myFirstBox[193].setConnections(0b10100110); myFirstBox[193].setConnections(0b10100110);
myFirstBox[194].setConnections(0b01010001); myFirstBox[194].setConnections(0b01010001);
myFirstBox[195].setConnections(0b01010101); myFirstBox[195].setConnections(0b01010101);
myFirstBox[196].setConnections(0b01100110); myFirstBox[196].setConnections(0b01100110);
myFirstBox[197].setConnections(0b10100101); myFirstBox[197].setConnections(0b10100101);
myFirstBox[198].setConnections(0b00100101); myFirstBox[198].setConnections(0b00100101);
myFirstBox[199].setConnections(0b00100101); myFirstBox[199].setConnections(0b00100101);
myFirstBox[200].setConnections(0b10101001); myFirstBox[200].setConnections(0b10101001);
myFirstBox[201].setConnections(0b10101001); myFirstBox[201].setConnections(0b10101001);
myFirstBox[202].setConnections(0b01011001); myFirstBox[202].setConnections(0b01011001);
myFirstBox[203].setConnections(0b00001010); myFirstBox[203].setConnections(0b00001010);
myFirstBox[204].setConnections(0b01010101); myFirstBox[204].setConnections(0b01010101);
myFirstBox[205].setConnections(0b10011010); myFirstBox[205].setConnections(0b10011010);
myFirstBox[206].setConnections(0b10100110); myFirstBox[206].setConnections(0b10100110);
myFirstBox[207].setConnections(0b10100101); myFirstBox[207].setConnections(0b10100101);
myFirstBox[208].setConnections(0b10011001); myFirstBox[208].setConnections(0b10011001);
myFirstBox[209].setConnections(0b10100110); myFirstBox[209].setConnections(0b10100110);
myFirstBox[210].setConnections(0b10101010); myFirstBox[210].setConnections(0b10101010);
myFirstBox[211].setConnections(0b01010110); myFirstBox[211].setConnections(0b01010110);
myFirstBox[212].setConnections(0b01010101); myFirstBox[212].setConnections(0b01010101);
myFirstBox[213].setConnections(0b01100010); myFirstBox[213].setConnections(0b01100010);
myFirstBox[214].setConnections(0b10010110); myFirstBox[214].setConnections(0b10010110);
myFirstBox[215].setConnections(0b10011010); myFirstBox[215].setConnections(0b10011010);
myFirstBox[216].setConnections(0b01100100); myFirstBox[216].setConnections(0b01100100);
myFirstBox[217].setConnections(0b01010101); myFirstBox[217].setConnections(0b01010101);
myFirstBox[218].setConnections(0b10011010); myFirstBox[218].setConnections(0b10011010);
myFirstBox[219].setConnections(0b01100101); myFirstBox[219].setConnections(0b01100101);
myFirstBox[220].setConnections(0b10101001); myFirstBox[220].setConnections(0b10101001);
myFirstBox[221].setConnections(0b10010101); myFirstBox[221].setConnections(0b10010101);
myFirstBox[222].setConnections(0b10100101); myFirstBox[222].setConnections(0b10100101);
myFirstBox[223].setConnections(0b10101001); myFirstBox[223].setConnections(0b10101001);
myFirstBox[224].setConnections(0b10100110); myFirstBox[224].setConnections(0b10100110);
myFirstBox[225].setConnections(0b10011001); myFirstBox[225].setConnections(0b10011001);
myFirstBox[226].setConnections(0b01011010); myFirstBox[226].setConnections(0b01011010);
myFirstBox[227].setConnections(0b01000101); myFirstBox[227].setConnections(0b01000101);
myFirstBox[228].setConnections(0b01100110); myFirstBox[228].setConnections(0b01100110);
myFirstBox[229].setConnections(0b10101010); myFirstBox[229].setConnections(0b10101010);
myFirstBox[230].setConnections(0b01010100); myFirstBox[230].setConnections(0b01010100);
myFirstBox[231].setConnections(0b10101010); myFirstBox[231].setConnections(0b10101010);
myFirstBox[232].setConnections(0b10011010); myFirstBox[232].setConnections(0b10011010);
myFirstBox[233].setConnections(0b10100110); myFirstBox[233].setConnections(0b10100110);
myFirstBox[234].setConnections(0b10011000); myFirstBox[234].setConnections(0b10011000);
myFirstBox[235].setConnections(0b10011001); myFirstBox[235].setConnections(0b10011001);
myFirstBox[236].setConnections(0b01010101); myFirstBox[236].setConnections(0b01010101);
myFirstBox[237].setConnections(0b01001010); myFirstBox[237].setConnections(0b01001010);
myFirstBox[238].setConnections(0b01100001); myFirstBox[238].setConnections(0b01100001);
myFirstBox[239].setConnections(0b10011010); myFirstBox[239].setConnections(0b10011010);
myFirstBox[240].setConnections(0b10010101); myFirstBox[240].setConnections(0b10010101);
myFirstBox[241].setConnections(0b10100110); myFirstBox[241].setConnections(0b10100110);
myFirstBox[242].setConnections(0b01010101); myFirstBox[242].setConnections(0b01010101);
myFirstBox[243].setConnections(0b10010101); myFirstBox[243].setConnections(0b10010101);
myFirstBox[244].setConnections(0b01101010); myFirstBox[244].setConnections(0b01101010);
myFirstBox[245].setConnections(0b01101010); myFirstBox[245].setConnections(0b01101010);
myFirstBox[246].setConnections(0b10100100); myFirstBox[246].setConnections(0b10100100);
myFirstBox[247].setConnections(0b00101010); myFirstBox[247].setConnections(0b00101010);
myFirstBox[248].setConnections(0b01100110); myFirstBox[248].setConnections(0b01100110);
myFirstBox[249].setConnections(0b01101000); myFirstBox[249].setConnections(0b01101000);
myFirstBox[250].setConnections(0b01101001); myFirstBox[250].setConnections(0b01101001);
myFirstBox[251].setConnections(0b10101001); myFirstBox[251].setConnections(0b10101001);
myFirstBox[252].setConnections(0b01010110); myFirstBox[252].setConnections(0b01010110);
myFirstBox[253].setConnections(0b10010110); myFirstBox[253].setConnections(0b10010110);
myFirstBox[254].setConnections(0b01100101); myFirstBox[254].setConnections(0b01100101);
myFirstBox[255].setConnections(0b01011001); myFirstBox[255].setConnections(0b01011001);
myFirstBox[256].setConnections(0b01100110); myFirstBox[256].setConnections(0b01100110);
myFirstBox[257].setConnections(0b00100101); myFirstBox[257].setConnections(0b00100101);
myFirstBox[258].setConnections(0b01101001); myFirstBox[258].setConnections(0b01101001);
myFirstBox[259].setConnections(0b10010110); myFirstBox[259].setConnections(0b10010110);
myFirstBox[260].setConnections(0b10011001); myFirstBox[260].setConnections(0b10011001);
myFirstBox[261].setConnections(0b10011001); myFirstBox[261].setConnections(0b10011001);
myFirstBox[262].setConnections(0b01101001); myFirstBox[262].setConnections(0b01101001);
myFirstBox[263].setConnections(0b01010010); myFirstBox[263].setConnections(0b01010010);
myFirstBox[264].setConnections(0b10101010); myFirstBox[264].setConnections(0b10101010);
myFirstBox[265].setConnections(0b01101001); myFirstBox[265].setConnections(0b01101001);
myFirstBox[266].setConnections(0b01101001); myFirstBox[266].setConnections(0b01101001);
myFirstBox[267].setConnections(0b01101001); myFirstBox[267].setConnections(0b01101001);
myFirstBox[268].setConnections(0b10010110); myFirstBox[268].setConnections(0b10010110);
myFirstBox[269].setConnections(0b10011001); myFirstBox[269].setConnections(0b10011001);
myFirstBox[270].setConnections(0b01101010); myFirstBox[270].setConnections(0b01101010);
myFirstBox[271].setConnections(0b10000110); myFirstBox[271].setConnections(0b10000110);
myFirstBox[272].setConnections(0b10010101); myFirstBox[272].setConnections(0b10010101);
myFirstBox[273].setConnections(0b00010101); myFirstBox[273].setConnections(0b00010101);
myFirstBox[274].setConnections(0b10101010); myFirstBox[274].setConnections(0b10101010);
myFirstBox[275].setConnections(0b01010110); myFirstBox[275].setConnections(0b01010110);
myFirstBox[276].setConnections(0b01100100); myFirstBox[276].setConnections(0b01100100);
myFirstBox[277].setConnections(0b01010101); myFirstBox[277].setConnections(0b01010101);
myFirstBox[278].setConnections(0b10010101); myFirstBox[278].setConnections(0b10010101);
myFirstBox[279].setConnections(0b01010101); myFirstBox[279].setConnections(0b01010101);
myFirstBox[280].setConnections(0b01011010); myFirstBox[280].setConnections(0b01011010);
myFirstBox[281].setConnections(0b10011010); myFirstBox[281].setConnections(0b10011010);
myFirstBox[282].setConnections(0b00010101); myFirstBox[282].setConnections(0b00010101);
myFirstBox[283].setConnections(0b10010110); myFirstBox[283].setConnections(0b10010110);
myFirstBox[284].setConnections(0b10100101); myFirstBox[284].setConnections(0b10100101);
myFirstBox[285].setConnections(0b10010101); myFirstBox[285].setConnections(0b10010101);
myFirstBox[286].setConnections(0b01101001); myFirstBox[286].setConnections(0b01101001);
myFirstBox[287].setConnections(0b10100101); myFirstBox[287].setConnections(0b10100101);
myFirstBox[288].setConnections(0b01101001); myFirstBox[288].setConnections(0b01101001);
myFirstBox[289].setConnections(0b10011001); myFirstBox[289].setConnections(0b10011001);
myFirstBox[290].setConnections(0b01011001); myFirstBox[290].setConnections(0b01011001);
myFirstBox[291].setConnections(0b10010110); myFirstBox[291].setConnections(0b10010110);
myFirstBox[292].setConnections(0b01010101); myFirstBox[292].setConnections(0b01010101);
myFirstBox[293].setConnections(0b10100110); myFirstBox[293].setConnections(0b10100110);
myFirstBox[294].setConnections(0b10101001); myFirstBox[294].setConnections(0b10101001);
myFirstBox[295].setConnections(0b10101001); myFirstBox[295].setConnections(0b10101001);
myFirstBox[296].setConnections(0b01011010); myFirstBox[296].setConnections(0b01011010);
myFirstBox[297].setConnections(0b10100101); myFirstBox[297].setConnections(0b10100101);
myFirstBox[298].setConnections(0b01011010); myFirstBox[298].setConnections(0b01011010);
myFirstBox[299].setConnections(0b01100110); myFirstBox[299].setConnections(0b01100110);
myFirstBox[300].setConnections(0b10010101); myFirstBox[300].setConnections(0b10010101);
myFirstBox[301].setConnections(0b10101001); myFirstBox[301].setConnections(0b10101001);
myFirstBox[302].setConnections(0b10011001); myFirstBox[302].setConnections(0b10011001);
myFirstBox[303].setConnections(0b01010101); myFirstBox[303].setConnections(0b01010101);
myFirstBox[304].setConnections(0b01010101); myFirstBox[304].setConnections(0b01010101);
myFirstBox[305].setConnections(0b10101001); myFirstBox[305].setConnections(0b10101001);
myFirstBox[306].setConnections(0b01100101); myFirstBox[306].setConnections(0b01100101);
myFirstBox[307].setConnections(0b01101000); myFirstBox[307].setConnections(0b01101000);
myFirstBox[308].setConnections(0b01010101); myFirstBox[308].setConnections(0b01010101);
myFirstBox[309].setConnections(0b10010110); myFirstBox[309].setConnections(0b10010110);
myFirstBox[310].setConnections(0b10010110); myFirstBox[310].setConnections(0b10010110);
myFirstBox[311].setConnections(0b01011010); myFirstBox[311].setConnections(0b01011010);
myFirstBox[312].setConnections(0b10010110); myFirstBox[312].setConnections(0b10010110);
myFirstBox[313].setConnections(0b01011001); myFirstBox[313].setConnections(0b01011001);
myFirstBox[314].setConnections(0b01010110); myFirstBox[314].setConnections(0b01010110);
myFirstBox[315].setConnections(0b01101001); myFirstBox[315].setConnections(0b01101001);
myFirstBox[316].setConnections(0b10100101); myFirstBox[316].setConnections(0b10100101);
myFirstBox[317].setConnections(0b10101010); myFirstBox[317].setConnections(0b10101010);
myFirstBox[318].setConnections(0b10011001); myFirstBox[318].setConnections(0b10011001);
myFirstBox[319].setConnections(0b01010110); myFirstBox[319].setConnections(0b01010110);
myFirstBox[320].setConnections(0b10100000); myFirstBox[320].setConnections(0b10100000);
myFirstBox[321].setConnections(0b10100101); myFirstBox[321].setConnections(0b10100101);
myFirstBox[322].setConnections(0b00010101); myFirstBox[322].setConnections(0b00010101);
myFirstBox[323].setConnections(0b01010110); myFirstBox[323].setConnections(0b01010110);
myFirstBox[324].setConnections(0b01101010); myFirstBox[324].setConnections(0b01101010);
myFirstBox[325].setConnections(0b10010110); myFirstBox[325].setConnections(0b10010110);
myFirstBox[326].setConnections(0b00001001); myFirstBox[326].setConnections(0b00001001);
myFirstBox[327].setConnections(0b10011010); myFirstBox[327].setConnections(0b10011010);
myFirstBox[328].setConnections(0b10101010); myFirstBox[328].setConnections(0b10101010);
myFirstBox[329].setConnections(0b01100101); myFirstBox[329].setConnections(0b01100101);
myFirstBox[330].setConnections(0b01011010); myFirstBox[330].setConnections(0b01011010);
myFirstBox[331].setConnections(0b01101010); myFirstBox[331].setConnections(0b01101010);
myFirstBox[332].setConnections(0b10100101); myFirstBox[332].setConnections(0b10100101);
myFirstBox[333].setConnections(0b10100101); myFirstBox[333].setConnections(0b10100101);
myFirstBox[334].setConnections(0b01011000); myFirstBox[334].setConnections(0b01011000);
myFirstBox[335].setConnections(0b01010110); myFirstBox[335].setConnections(0b01010110);
myFirstBox[336].setConnections(0b00100110); myFirstBox[336].setConnections(0b00100110);
myFirstBox[337].setConnections(0b01101010); myFirstBox[337].setConnections(0b01101010);
myFirstBox[338].setConnections(0b01101010); myFirstBox[338].setConnections(0b01101010);
myFirstBox[339].setConnections(0b10010110); myFirstBox[339].setConnections(0b10010110);
myFirstBox[340].setConnections(0b10101010); myFirstBox[340].setConnections(0b10101010);
myFirstBox[341].setConnections(0b01100110); myFirstBox[341].setConnections(0b01100110);
myFirstBox[342].setConnections(0b10011000); myFirstBox[342].setConnections(0b10011000);
myFirstBox[343].setConnections(0b10101010); myFirstBox[343].setConnections(0b10101010);
myFirstBox[344].setConnections(0b01011001); myFirstBox[344].setConnections(0b01011001);
myFirstBox[345].setConnections(0b01101001); myFirstBox[345].setConnections(0b01101001);
myFirstBox[346].setConnections(0b10010101); myFirstBox[346].setConnections(0b10010101);
myFirstBox[347].setConnections(0b10101010); myFirstBox[347].setConnections(0b10101010);
myFirstBox[348].setConnections(0b10011001); myFirstBox[348].setConnections(0b10011001);
myFirstBox[349].setConnections(0b01101001); myFirstBox[349].setConnections(0b01101001);
myFirstBox[350].setConnections(0b01010110); myFirstBox[350].setConnections(0b01010110);
myFirstBox[351].setConnections(0b10000110); myFirstBox[351].setConnections(0b10000110);
myFirstBox[352].setConnections(0b10010110); myFirstBox[352].setConnections(0b10010110);
myFirstBox[353].setConnections(0b10011010); myFirstBox[353].setConnections(0b10011010);
myFirstBox[354].setConnections(0b01010110); myFirstBox[354].setConnections(0b01010110);
myFirstBox[355].setConnections(0b10010010); myFirstBox[355].setConnections(0b10010010);
myFirstBox[356].setConnections(0b10100110); myFirstBox[356].setConnections(0b10100110);
myFirstBox[357].setConnections(0b10101001); myFirstBox[357].setConnections(0b10101001);
myFirstBox[358].setConnections(0b01011001); myFirstBox[358].setConnections(0b01011001);
myFirstBox[359].setConnections(0b01010000); myFirstBox[359].setConnections(0b01010000);
myFirstBox[360].setConnections(0b10011001); myFirstBox[360].setConnections(0b10011001);
myFirstBox[361].setConnections(0b01101001); myFirstBox[361].setConnections(0b01101001);
myFirstBox[362].setConnections(0b01100001); myFirstBox[362].setConnections(0b01100001);
myFirstBox[363].setConnections(0b10100110); myFirstBox[363].setConnections(0b10100110);
myFirstBox[364].setConnections(0b10100101); myFirstBox[364].setConnections(0b10100101);
myFirstBox[365].setConnections(0b01100101); myFirstBox[365].setConnections(0b01100101);
myFirstBox[366].setConnections(0b01001010); myFirstBox[366].setConnections(0b01001010);
myFirstBox[367].setConnections(0b10010110); myFirstBox[367].setConnections(0b10010110);
myFirstBox[368].setConnections(0b10010101); myFirstBox[368].setConnections(0b10010101);
myFirstBox[369].setConnections(0b10010100); myFirstBox[369].setConnections(0b10010100);
myFirstBox[370].setConnections(0b01010101); myFirstBox[370].setConnections(0b01010101);
myFirstBox[371].setConnections(0b01011000); myFirstBox[371].setConnections(0b01011000);
myFirstBox[372].setConnections(0b01100010); myFirstBox[372].setConnections(0b01100010);
myFirstBox[373].setConnections(0b10011001); myFirstBox[373].setConnections(0b10011001);
myFirstBox[374].setConnections(0b01100110); myFirstBox[374].setConnections(0b01100110);
myFirstBox[375].setConnections(0b10100101); myFirstBox[375].setConnections(0b10100101);
myFirstBox[376].setConnections(0b01000110); myFirstBox[376].setConnections(0b01000110);
myFirstBox[377].setConnections(0b01010101); myFirstBox[377].setConnections(0b01010101);
myFirstBox[378].setConnections(0b01100110); myFirstBox[378].setConnections(0b01100110);
myFirstBox[379].setConnections(0b10100110); myFirstBox[379].setConnections(0b10100110);
myFirstBox[380].setConnections(0b00100110); myFirstBox[380].setConnections(0b00100110);
myFirstBox[381].setConnections(0b01101001); myFirstBox[381].setConnections(0b01101001);
myFirstBox[382].setConnections(0b01100101); myFirstBox[382].setConnections(0b01100101);
myFirstBox[383].setConnections(0b10010101); myFirstBox[383].setConnections(0b10010101);
myFirstBox[384].setConnections(0b01101001); myFirstBox[384].setConnections(0b01101001);
myFirstBox[385].setConnections(0b10010110); myFirstBox[385].setConnections(0b10010110);
myFirstBox[386].setConnections(0b10010101); myFirstBox[386].setConnections(0b10010101);
myFirstBox[387].setConnections(0b10101001); myFirstBox[387].setConnections(0b10101001);
myFirstBox[388].setConnections(0b10011001); myFirstBox[388].setConnections(0b10011001);
myFirstBox[389].setConnections(0b01010110); myFirstBox[389].setConnections(0b01010110);
myFirstBox[390].setConnections(0b10100010); myFirstBox[390].setConnections(0b10100010);
myFirstBox[391].setConnections(0b10101001); myFirstBox[391].setConnections(0b10101001);
myFirstBox[392].setConnections(0b01101010); myFirstBox[392].setConnections(0b01101010);
myFirstBox[393].setConnections(0b10101010); myFirstBox[393].setConnections(0b10101010);
myFirstBox[394].setConnections(0b01100110); myFirstBox[394].setConnections(0b01100110);
myFirstBox[395].setConnections(0b01010101); myFirstBox[395].setConnections(0b01010101);
myFirstBox[396].setConnections(0b01101001); myFirstBox[396].setConnections(0b01101001);
myFirstBox[397].setConnections(0b10010101); myFirstBox[397].setConnections(0b10010101);
myFirstBox[398].setConnections(0b10100110); myFirstBox[398].setConnections(0b10100110);
myFirstBox[399].setConnections(0b01101010); myFirstBox[399].setConnections(0b01101010);
return; return;
} }

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