def compareS(): rotation = 1 lowest = 999999 lowestIndex = 0 # list of all height values for L rot1 Srot1 = compareS1() Srot2 = compareS2() i = 0 while i <= 7: if Srot1[i] < lowest: lowest = Srot1[i] lowestIndex = i rotation = 1 i = i + 1 i = 0 while i <= 8: if Srot2[i] < lowest: lowest = Srot2[i] lowestIndex = i rotation = 2 i = i + 1 if rotation == 1: distribution[S1] = distribution[S1] + 1 functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) if colh[lowestIndex + 2] > colh[lowestIndex + 1] and colh[ lowestIndex + 2] > colh[lowestIndex]: boardState[lowestIndex][highest] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest] = 1 boardState[lowestIndex + 2][highest + 1] = 1 else: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 2][highest + 2] = 1 if rotation == 2: distribution[S2] = distribution[S2] + 1 keyPress.moveUp() highest = getHighest2(lowestIndex) functions.placePiece2(lowestIndex) if colh[lowestIndex] > colh[lowestIndex + 1]: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest] = 1 else: boardState[lowestIndex][highest + 3] = 1 boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1
def compareZ(): rotation = 1 lowest = 999999 lowestIndex = 0 # list of all height values for L rot1 Zrot1 = compareZ1() Zrot2 = compareZ2() i = 0 while i <= 7: if Zrot1[i] < lowest: lowest = Zrot1[i] lowestIndex = i rotation = 1 i = i + 1 i = 0 while i <= 8: if Zrot2[i] < lowest: # <= to go right, < to go left lowest = Zrot2[i] lowestIndex = i rotation = 2 i = i + 1 if rotation == 1: distribution[Z1] = distribution[Z1] + 1 functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) if colh[lowestIndex] > colh[ lowestIndex + 1] and colh[lowestIndex] > colh[lowestIndex + 2]: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest] = 1 boardState[lowestIndex + 2][highest] = 1 else: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 2][highest + 1] = 1 if rotation == 2: distribution[Z2] = distribution[Z2] + 1 keyPress.moveUp() highest = getHighest2(lowestIndex) functions.placePiece2(lowestIndex) if colh[lowestIndex + 1] > colh[lowestIndex]: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex][highest] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 else: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 3] = 1 boardState[lowestIndex + 1][highest + 2] = 1
def compareT(): rotation = 1 lowest = 999999 lowestIndex = 0 # list of all height values for L rot1 Trot1 = compareT1() Trot2 = compareT2() Trot3 = compareT3() Trot4 = compareT4() i = 0 while i <= 7: if Trot1[i] <= lowest: lowest = Trot1[i] lowestIndex = i rotation = 1 i = i + 1 i = 0 while i <= 8: if Trot2[i] <= lowest: lowest = Trot2[i] lowestIndex = i rotation = 2 i = i + 1 i = 0 while i <= 7: if Trot3[i] <= lowest: lowest = Trot3[i] lowestIndex = i rotation = 3 i = i + 1 i = 0 while i <= 8: if Trot4[i] <= lowest: lowest = Trot4[i] lowestIndex = i rotation = 4 i = i + 1 if rotation == 1: distribution[T1] = distribution[T1] + 1 functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 2][highest + 1] = 1 if rotation == 2: distribution[T2] = distribution[T2] + 1 keyPress.moveUp() highest = getHighest2(lowestIndex) functions.placePiece2(lowestIndex) if colh[lowestIndex + 1] > colh[lowestIndex]: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex][highest] = 1 boardState[lowestIndex + 1][highest + 1] = 1 else: boardState[lowestIndex][highest + 3] = 1 boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 2] = 1 if rotation == 3: distribution[T3] = distribution[T3] + 1 keyPress.moveUp() keyPress.moveUp() functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) if colh[lowestIndex + 1] >= colh[lowestIndex] and colh[ lowestIndex + 1] >= colh[lowestIndex + 2]: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 2][highest + 2] = 1 else: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest] = 1 boardState[lowestIndex + 2][highest + 1] = 1 if rotation == 4: distribution[T4] = distribution[T4] + 1 keyPress.moveUp() keyPress.moveUp() keyPress.moveUp() highest = getHighest2(lowestIndex) functions.placePiece2b(lowestIndex) if colh[lowestIndex] > colh[lowestIndex + 1]: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest] = 1 else: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex + 1][highest + 3] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1
def compareJ(): rotation = 1 lowest = 999999 lowestIndex = 0 # list of all height values for L rot1 Jrot1 = compareJ1() Jrot2 = compareJ2() Jrot3 = compareJ3() Jrot4 = compareJ4() i = 0 while i <= 8: if Jrot4[i] <= lowest: lowest = Jrot4[i] lowestIndex = i rotation = 4 i = i + 1 i = 0 while i <= 7: if Jrot1[i] <= lowest: lowest = Jrot1[i] lowestIndex = i rotation = 1 i = i + 1 i = 0 while i <= 7: if Jrot3[i] <= lowest: lowest = Jrot3[i] lowestIndex = i rotation = 3 i = i + 1 i = 0 while i <= 8: if Jrot2[i] <= lowest: lowest = Jrot2[i] lowestIndex = i rotation = 2 i = i + 1 if rotation == 1: distribution[J1] = distribution[J1] + 1 functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 2][highest + 1] = 1 if rotation == 2: distribution[J2] = distribution[J2] + 1 keyPress.moveUp() functions.placePiece2(lowestIndex) highest = getHighest2(lowestIndex) if colh[lowestIndex] >= colh[lowestIndex + 1]: boardState[lowestIndex][highest + 3] = 1 boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 3] = 1 elif colh[lowestIndex] + 1 >= colh[lowestIndex + 1]: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex][highest] = 1 boardState[lowestIndex + 1][highest + 2] = 1 else: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex][highest] = 1 boardState[lowestIndex][highest - 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 if rotation == 3: distribution[J3] = distribution[J3] + 1 keyPress.moveUp() keyPress.moveUp() functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) if colh[lowestIndex + 2] >= colh[lowestIndex + 1] and colh[ lowestIndex + 2] >= colh[lowestIndex]: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 2][highest + 2] = 1 boardState[lowestIndex + 2][highest + 1] = 1 else: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 2][highest + 1] = 1 boardState[lowestIndex + 2][highest] = 1 if rotation == 4: distribution[J4] = distribution[J4] + 1 keyPress.moveUp() keyPress.moveUp() keyPress.moveUp() functions.placePiece2b(lowestIndex) highest = getHighest2(lowestIndex) boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 3] = 1
def compareL(): rotation = 1 lowest = 999999 lowestIndex = 0 # list of all height values for L rot1 Lrot1 = compareL1() Lrot2 = compareL2() Lrot3 = compareL3() Lrot4 = compareL4() i = 0 while i <= 8: # LOWEST PRIORITY! if Lrot2[i] <= lowest: lowest = Lrot2[i] lowestIndex = i rotation = 2 i = i + 1 i = 0 while i <= 7: if Lrot1[i] <= lowest: lowest = Lrot1[i] lowestIndex = i rotation = 1 i = i + 1 i = 0 while i <= 7: if Lrot3[i] <= lowest: lowest = Lrot3[i] lowestIndex = i rotation = 3 i = i + 1 i = 0 while i <= 8: if Lrot4[i] <= lowest: lowest = Lrot4[i] lowestIndex = i rotation = 4 i = i + 1 if rotation == 1: distribution[L1] = distribution[L1] + 1 functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 2][highest + 1] = 1 boardState[lowestIndex + 2][highest + 2] = 1 if rotation == 2: distribution[L2] = distribution[L2] + 1 keyPress.moveUp() functions.placePiece2(lowestIndex) highest = getHighest2(lowestIndex) boardState[lowestIndex][highest + 3] = 1 boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 if rotation == 3: distribution[L3] = distribution[L3] + 1 keyPress.moveUp() keyPress.moveUp() functions.placePiece3(lowestIndex) highest = getHighest3(lowestIndex) if colh[lowestIndex] >= colh[ lowestIndex + 1] and colh[lowestIndex] >= colh[lowestIndex + 2]: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 2][highest + 2] = 1 else: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex][highest] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 2][highest + 1] = 1 if rotation == 4: distribution[L4] = distribution[L4] + 1 keyPress.moveUp() keyPress.moveUp() keyPress.moveUp() functions.placePiece2b(lowestIndex) highest = getHighest2(lowestIndex) if colh[lowestIndex + 1] >= colh[lowestIndex]: boardState[lowestIndex][highest + 3] = 1 boardState[lowestIndex + 1][highest + 3] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 elif colh[lowestIndex + 1] + 1 >= colh[lowestIndex]: boardState[lowestIndex][highest + 2] = 1 boardState[lowestIndex + 1][highest + 2] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest] = 1 else: boardState[lowestIndex][highest + 1] = 1 boardState[lowestIndex + 1][highest + 1] = 1 boardState[lowestIndex + 1][highest] = 1 boardState[lowestIndex + 1][highest - 1] = 1