#include <LedControl.h>
#define DIN 5
#define CS 4 //LED DISPLAY PORTS
#define CLK 3
#define leftButton 8
#define rightButton 9 ///MOVE BUTTONS
#define rotateButton 10
#define startButton 2 //START BUTTON
// BOARD ITSELF AS A MATRIX
bool board[16][8]; // PLAYAREA : 1 - 14; 1-6;
//PIECE LOCATION
byte currentPieceLocation[4][2];
byte currentPieceID = 0;
byte currentPieceOrientation = 0;
bool hasCollisionDown[4];
bool hasCollisionRight[4];
bool hasCollisionLeft[4];
// Things i use or not idk
bool started = false;
byte buttonState = 0;
int globalDelay = 10;
bool pieceOnBoard = false;
bool gameover = false;
bool lefutott = false;
byte bias = -1;
byte digRRotate = HIGH;
byte digRRight = HIGH;
byte digRLeft = HIGH;
byte timeIndexer = 0;
// LedControl(dataPin,clockPin,csPin,numDevices)
LedControl lc = LedControl(DIN,CLK,CS,2);
void setup() {
pinMode(rotateButton, INPUT_PULLUP);
pinMode(rightButton, INPUT_PULLUP);
pinMode(leftButton, INPUT_PULLUP);
pinMode(startButton, INPUT_PULLUP);
lc.shutdown(0,false);
lc.shutdown(1,false);
lc.setIntensity(0,0.8);
lc.setIntensity(1,0.8);
randomSeed(analogRead(A2));
}
void loop() {
start();
if(started && !gameover){
game();
}
else if(gameover && !lefutott){gameOver();lefutott = true;}
}
void start(){
buttonState = digitalRead(startButton);
if(buttonState == LOW && !started) {
started = true;
startSequence();
gameover = false;
lefutott = false;
}
}
void startSequence(){
for(int i =0; i< 16; i++){
for(int j = 0 ; j < 8; j++){
lc.setLed(i/8, j, i%8, true);
delay(17);
lc.setLed(i/8, j, i%8, false);
delay(17);
}
}
for(int k = 0; k< 2; k++){
for(int i =0; i< 16; i++){
for(int j = 0 ; j < 8; j++){
lc.setLed(i/8, j, i%8, true);
}
}
delay(200);
for(int i =0; i< 16; i++){
for(int j = 0 ; j < 8; j++){
lc.setLed(i/8, j, i%8, false);
}
}
delay(300);
}
}
void writeMatrix(){
for(int i =0; i< 16; i++){
for(int j = 0 ; j < 8; j++){
lc.setLed(i/8, j , i%8, board[i][j]);
}
}
}
void game(){
initEdge();
if(!pieceOnBoard)spawnPiece();
while(pieceOnBoard ){
if(digRLeft == HIGH)digRLeft = digitalRead(leftButton);
if(digRRight == HIGH)digRRight = digitalRead(rightButton);
if(digRRotate)digRRotate = digitalRead(rotateButton);
if(digRLeft == LOW){
moveLeft();
writeMatrix();
digRLeft = HIGH;
}
if(digRRight == LOW){
moveRight();
writeMatrix();
digRRight = HIGH;
}
if(digRRotate == LOW){
rotatePiece();
writeMatrix();
digRRotate = HIGH;
}
else if(timeIndexer >= (400/globalDelay)){
autoMoveDown();
writeMatrix();
if(!pieceOnBoard) break;
timeIndexer = 0;
}
if(!pieceOnBoard) continue;
delay(globalDelay);
timeIndexer++;
}
writeMatrix();
}
void initEdge(){
for(int i = 0; i< 16; i++){
board[i][0] = true;
board[i][7] = true;
}
for(int i = 0; i < 8; i++){
board[0][i] = true;
board[15][i] = true;
}
writeMatrix();
}
void spawnPiece(){
int pieceNum = random(1, 8);
while(bias == pieceNum) pieceNum = random(1, 8);
bias = pieceNum;
switch(pieceNum){
case 1: spawnRod(); currentPieceID = 0; currentPieceOrientation = 0; break; // PIECEID -> 0
case 2: spawnL(); currentPieceID = 1; currentPieceOrientation = 0; break; // PIECEID -> 1
case 3: spawnL2(); currentPieceID = 2; currentPieceOrientation = 0; break; // PIECEID -> 2
case 4: spawnKoxka(); currentPieceID = 3; currentPieceOrientation = 0; break; // PIECEID -> 3
case 5: spawnZ(); currentPieceID = 4; currentPieceOrientation = 0; break; // PIECEID -> 4
case 6: spawnT(); currentPieceID = 5; currentPieceOrientation = 0; break; // PIECEID -> 5
case 7: spawnS(); currentPieceID = 6; currentPieceOrientation = 0; break; // PIECEID -> 6
}
pieceOnBoard = true;
}
void spawnRod(){// ROD 4x1 - 2,3,4,5
currentPieceLocation[0][0] = 15;
currentPieceLocation[0][1] = 2;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
currentPieceLocation[1][0] = 15;
currentPieceLocation[1][1] = 3;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
currentPieceLocation[2][0] = 15;
currentPieceLocation[2][1] = 4;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
currentPieceLocation[3][0] = 15;
currentPieceLocation[3][1] = 5;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
}
void spawnL(){// L 3x1 + 1x1, 3,4,5 + 5
currentPieceLocation[0][0] = 15;
currentPieceLocation[0][1] = 3;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
currentPieceLocation[1][0] = 15;
currentPieceLocation[1][1] = 4;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
currentPieceLocation[2][0] = 15;
currentPieceLocation[2][1] = 5;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = false;
currentPieceLocation[3][0] = 14;
currentPieceLocation[3][1] = 5;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
board[14][5] = true;
writeMatrix();
}
void spawnL2(){// L 3x1 + 1x1, 3,4,5 + 3
currentPieceLocation[0][0] = 15;
currentPieceLocation[0][1] = 3;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = false;
currentPieceLocation[1][0] = 15;
currentPieceLocation[1][1] = 4;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
currentPieceLocation[2][0] = 15;
currentPieceLocation[2][1] = 5;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = true;
currentPieceLocation[3][0] = 14;
currentPieceLocation[3][1] = 3;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = false;
hasCollisionDown[3] = true;
board[14][3] = true;
writeMatrix();
}
void spawnKoxka(){// koxka 2x(2x2) 3,4 + 3,4
currentPieceLocation[0][0] = 15;
currentPieceLocation[0][1] = 3;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = false;
currentPieceLocation[1][0] = 15;
currentPieceLocation[1][1] = 4;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = false;
currentPieceLocation[2][0] = 14;
currentPieceLocation[2][1] = 3;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
currentPieceLocation[3][0] = 14;
currentPieceLocation[3][1] = 4;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
board[14][3] = true;
board[14][4] = true;
writeMatrix();
}
void spawnZ(){// Z 2x2 + 2x2, 3,4 + 3,2
currentPieceLocation[0][0] = 15;
currentPieceLocation[0][1] = 3;
hasCollisionRight[0] = false;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = false;
currentPieceLocation[1][0] = 15;
currentPieceLocation[1][1] = 4;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = true;
currentPieceLocation[2][0] = 14;
currentPieceLocation[2][1] = 2;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
currentPieceLocation[3][0] = 14;
currentPieceLocation[3][1] = 3;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = false;
hasCollisionDown[3] = true;
board[14][3] = true;
board[14][2] = true;
writeMatrix();
}
void spawnS(){// S 2x2 + 2x2, 3,4 + 5,4
currentPieceLocation[0][0] = 15;
currentPieceLocation[0][1] = 3;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
currentPieceLocation[1][0] = 15;
currentPieceLocation[1][1] = 4;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = false;
currentPieceLocation[2][0] = 14;
currentPieceLocation[2][1] = 4;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
currentPieceLocation[3][0] = 14;
currentPieceLocation[3][1] = 5;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
board[14][4] = true;
board[14][5] = true;
writeMatrix();
}
void spawnT(){// T 3x1 + 1x1 3,4,5 + 4
currentPieceLocation[0][0] = 15;
currentPieceLocation[0][1] = 3;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
currentPieceLocation[1][0] = 15;
currentPieceLocation[1][1] = 4;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = false;
currentPieceLocation[2][0] = 15;
currentPieceLocation[2][1] = 5;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = true;
currentPieceLocation[3][0] = 14;
currentPieceLocation[3][1] = 4;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = false;
hasCollisionDown[3] = true;
board[14][4] = true;
writeMatrix();
}
void autoMoveDown(){
bool go = true;
for(int i =3; i>=0;i--){
int pieceRow = currentPieceLocation[i][0];
int pieceCol = currentPieceLocation[i][1];
if(hasCollisionDown[i] && board[pieceRow-1][pieceCol] && pieceRow-1 != 15) {
go = false;
pieceOnBoard = false;
checkMatrix();
}
}
if(go){
for(int i = 3; i>=0;i--){
int pieceRow = currentPieceLocation[i][0];
int pieceCol = currentPieceLocation[i][1];
if(pieceCol != 7 && pieceCol != 0 && pieceRow != 15)board[pieceRow][pieceCol] = false;
pieceRow--;
board[pieceRow][pieceCol] = true;
currentPieceLocation[i][0] = pieceRow;
}
}
else {
for(int i = 1; i<7;i++){
if(board[14][i]) gameover = true;
}
}
}
void moveLeft(){
bool goL = true;
for(int i =3; i>=0;i--){
int pieceRow = currentPieceLocation[i][0];
int pieceCol = currentPieceLocation[i][1];
if(hasCollisionLeft[i] && board[pieceRow][pieceCol+1]) {
goL = false;
timeIndexer++;
}
}
if(goL){
for(int i = 3; i>=0;i--){
int pieceRow = currentPieceLocation[i][0];
int pieceCol = currentPieceLocation[i][1];
if(pieceCol != 7 && pieceCol != 0 && pieceRow != 15)board[pieceRow][pieceCol] = false;
pieceCol++;
board[pieceRow][pieceCol] = true;
currentPieceLocation[i][1] = pieceCol;
}
}
}
void moveRight(){
bool goR = true;
for(int i =3; i>=0;i--){
int pieceRow = currentPieceLocation[i][0];
int pieceCol = currentPieceLocation[i][1];
if(hasCollisionRight[i] && board[pieceRow][pieceCol-1]) {
goR = false;
timeIndexer++;
}
}
if(goR){
for(int i = 0; i<4;i++){
int pieceRow = currentPieceLocation[i][0];
int pieceCol = currentPieceLocation[i][1];
if(pieceCol != 7 && pieceCol != 0 && pieceRow != 15)board[pieceRow][pieceCol] = false;
pieceCol--;
board[pieceRow][pieceCol] = true;
currentPieceLocation[i][1] = pieceCol;
}
}
}
void gameOver(){
for(int k = 0; k< 2; k++){
for(int i =15; i>=0 ; i--){
for(int j = 7 ; j >=0; j--){
lc.setLed(i/8, j, i%8, true);
}
}
delay(200);
for(int i =15; i>=0 ; i--){
for(int j = 0 ; j < 8; j++){
lc.setLed(i/8, j, i%8, false);
}
}
delay(300);
}
for(int i =15; i>=0 ; i--){
for(int j = 7 ; j >=0; j--){
lc.setLed(i/8, j, i%8, true);
delay(17);
lc.setLed(i/8, j, i%8, false);
delay(17);
}
}
lc.clearDisplay(0);
lc.clearDisplay(1);
started = false;
nullMatrix();
}
void checkMatrix(){
for(int i =1; i< 15; i++){
bool line = true;
for(int j = 1 ; j < 7; j++){
if(!board[i][j]) {
line = false;
break;
}
}
if(line){
for(int j = 1 ; j < 7; j++){
board[i][j] = false;
}
leesik(i);
}
}
writeMatrix();
}
void leesik(int sor){
for(int i = sor; i < 13; i++){
for(int j = 1 ; j < 7; j++){
board[i][j] = board[i+1][j];
board[i+1][j] = false;
}
}
pieceOnBoard = false;
writeMatrix();
}
void nullMatrix(){
for(int i =0; i< 16; i++){
for(int j = 0 ; j < 8; j++){
board[i][j] = false;
}
}
}
void rotatePiece(){ //NOT IMPLEMENTED
switch(currentPieceID){
case 0: rotateRod(); break; //2
case 1: rotateL(); break; //4
case 2: rotateL2(); break; //4
case 4: rotateZ(); break; //2
case 5: rotateT(); break; //4
case 6: rotateS(); break; //2
default : timeIndexer++; break;
}
writeMatrix();
}
void rotateRod(){ // | orientation 0, ---- orientation 1
byte fogoPontRow = currentPieceLocation[3][0];
byte fogoPontCol = currentPieceLocation[3][1];
byte orient = currentPieceOrientation;
if(orient == 1){
bool goRodR = true;
bool goRodL = true;
for(int i = fogoPontCol-1; i >= fogoPontCol-3; i--){
if(board[fogoPontRow][i]) {
goRodR = false;
break;
}
}
for(int i = fogoPontCol+1; i <= fogoPontCol+3; i++) {
if(board[fogoPontRow][i]) {
goRodL = false;
break;
}
}
// currentPieceOrientation = 0;
if(goRodL){
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = fogoPontRow;
currentPieceLocation[3][1] = fogoPontCol+3;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = fogoPontRow;
currentPieceLocation[2][1] = fogoPontCol+2;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = fogoPontRow;
currentPieceLocation[1][1] = fogoPontCol+1;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = fogoPontRow;
currentPieceLocation[0][1] = fogoPontCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
currentPieceOrientation = 0;
}
else if(goRodR){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = fogoPontRow;
currentPieceLocation[0][1] = fogoPontCol-3;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = fogoPontRow;
currentPieceLocation[1][1] = fogoPontCol-2;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = fogoPontRow;
currentPieceLocation[2][1] = fogoPontCol-1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
currentPieceOrientation = 0;
}
else timeIndexer++;
}
else{
bool goRodUp = true;
for(int i = fogoPontRow+1; i <= fogoPontRow+3; i++) {
if(board[i][fogoPontCol]) {
goRodUp = false;
break;
}
}
if(goRodUp){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = fogoPontRow+3;
currentPieceLocation[0][1] = fogoPontCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = fogoPontRow+2;
currentPieceLocation[1][1] = fogoPontCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = false;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = fogoPontRow+1;
currentPieceLocation[2][1] = fogoPontCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = false;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
currentPieceOrientation = 1;
}
else timeIndexer++;
}
}
void rotateT(){
if(currentPieceOrientation == 3){
byte centerPieceRow = currentPieceLocation[1][0];
byte centerPieceCol = currentPieceLocation[1][1];
if(!board[centerPieceRow][centerPieceCol-1]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = centerPieceRow;
currentPieceLocation[0][1] = centerPieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
// CENTER PIECE
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = centerPieceRow;
currentPieceLocation[1][1] = centerPieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = false;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = centerPieceRow;
currentPieceLocation[2][1] = centerPieceCol+1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = centerPieceRow-1;
currentPieceLocation[3][1] = centerPieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 0;
}
}
else if(currentPieceOrientation == 2){
byte centerPieceRow = currentPieceLocation[2][0];
byte centerPieceCol = currentPieceLocation[2][1];
if(!board[centerPieceRow-1][centerPieceCol]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = centerPieceRow+1;
currentPieceLocation[0][1] = centerPieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
// CENTER PIECE
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = centerPieceRow;
currentPieceLocation[1][1] = centerPieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = false;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = centerPieceRow;
currentPieceLocation[2][1] = centerPieceCol+1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = centerPieceRow-1;
currentPieceLocation[3][1] = centerPieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 3;
}
}
else if(currentPieceOrientation == 1){
byte centerPieceRow = currentPieceLocation[2][0];
byte centerPieceCol = currentPieceLocation[2][1];
if(!board[centerPieceRow][centerPieceCol+1]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = centerPieceRow+1;
currentPieceLocation[0][1] = centerPieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = false;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = centerPieceRow;
currentPieceLocation[1][1] = centerPieceCol-1;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
// CENTER PIECE
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = centerPieceRow;
currentPieceLocation[2][1] = centerPieceCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = centerPieceRow;
currentPieceLocation[3][1] = centerPieceCol+1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 2;
}
}
else if(currentPieceOrientation == 0){
byte centerPieceRow = currentPieceLocation[1][0];
byte centerPieceCol = currentPieceLocation[1][1];
if(!board[centerPieceRow+1][centerPieceCol]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = centerPieceRow+1;
currentPieceLocation[0][1] = centerPieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = false;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = centerPieceRow;
currentPieceLocation[1][1] = centerPieceCol-1;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
// CENTER PIECE
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = centerPieceRow;
currentPieceLocation[2][1] = centerPieceCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = false;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = centerPieceRow-1;
currentPieceLocation[3][1] = centerPieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 1;
}
}
else{
timeIndexer++;
}
}
void rotateZ(){
if(currentPieceOrientation == 1){
byte lastPieceRow = currentPieceLocation[3][0];
byte lastPieceCol = currentPieceLocation[3][1];
if(!board[currentPieceLocation[2][0]][currentPieceLocation[2][1]+1] && !board[currentPieceLocation[2][0]-1][currentPieceLocation[2][1]]-2){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = lastPieceRow+1;
currentPieceLocation[0][1] = lastPieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = false;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = lastPieceRow+1;
currentPieceLocation[1][1] = lastPieceCol+1;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = lastPieceRow;
currentPieceLocation[2][1] = lastPieceCol-1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = lastPieceRow;
currentPieceLocation[3][1] = lastPieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 0;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 0){
byte lastPieceRow = currentPieceLocation[3][0];
byte lastPieceCol = currentPieceLocation[3][1];
if(!board[currentPieceLocation[3][0]-1][currentPieceLocation[3][1]] && !board[currentPieceLocation[3][0]+2][currentPieceLocation[3][1]]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = lastPieceRow+1;
currentPieceLocation[0][1] = lastPieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = lastPieceRow;
currentPieceLocation[1][1] = lastPieceCol-1;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = lastPieceRow;
currentPieceLocation[2][1] = lastPieceCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = false;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = lastPieceRow-1;
currentPieceLocation[3][1] = lastPieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 1;
}
else timeIndexer++;
}
}
void rotateS(){
if(currentPieceOrientation == 1){
byte lastPieceRow = currentPieceLocation[3][0];
byte lastPieceCol = currentPieceLocation[3][1];
if(!board[currentPieceLocation[3][0]+2][currentPieceLocation[3][1]-1] && !board[currentPieceLocation[3][0]+2][currentPieceLocation[3][1]]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = lastPieceRow+2;
currentPieceLocation[0][1] = lastPieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = lastPieceRow+2;
currentPieceLocation[1][1] = lastPieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = false;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = lastPieceRow+1;
currentPieceLocation[2][1] = lastPieceCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = lastPieceRow+1;
currentPieceLocation[3][1] = lastPieceCol+1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 0;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 0){
byte lastPieceRow = currentPieceLocation[3][0];
byte lastPieceCol = currentPieceLocation[3][1];
if(!board[currentPieceLocation[3][0]+1][currentPieceLocation[3][1]] && !board[currentPieceLocation[2][0]-1][currentPieceLocation[2][1]]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = lastPieceRow+1;
currentPieceLocation[0][1] = lastPieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = lastPieceRow;
currentPieceLocation[1][1] = lastPieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = lastPieceRow;
currentPieceLocation[2][1] = lastPieceCol-1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = false;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = lastPieceRow-1;
currentPieceLocation[3][1] = lastPieceCol-1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 1;
}
else timeIndexer++;
}
}
void rotateL(){
byte pieceRow = currentPieceLocation[3][0];
byte pieceCol = currentPieceLocation[3][1];
if(currentPieceOrientation == 3){
if(!board[pieceRow][pieceCol+1] && !board[pieceRow+1][pieceCol+1] && !board[pieceRow+1][pieceCol-1]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+1;
currentPieceLocation[0][1] = pieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow+1;
currentPieceLocation[1][1] = pieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow+1;
currentPieceLocation[2][1] = pieceCol+1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = false;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow;
currentPieceLocation[3][1] = pieceCol+1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 0;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 2){
if(!board[pieceRow+1][pieceCol] &&!board[pieceRow-1][pieceCol-1] &&!board[pieceRow+1][pieceCol-1]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+1;
currentPieceLocation[0][1] = pieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow+1;
currentPieceLocation[1][1] = pieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow;
currentPieceLocation[2][1] = pieceCol-1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = false;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow-1;
currentPieceLocation[3][1] = pieceCol-1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 3;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 1){
if(!board[pieceRow-1][pieceCol+1] && !board[pieceRow][pieceCol+1]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+1;
currentPieceLocation[0][1] = pieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow;
currentPieceLocation[1][1] = pieceCol-1;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow;
currentPieceLocation[2][1] = pieceCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow;
currentPieceLocation[3][1] = pieceCol+1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 2;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 0){
if(!board[pieceRow][pieceCol-1] && !board[pieceRow+2][pieceCol]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+2;
currentPieceLocation[0][1] = pieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow+1;
currentPieceLocation[1][1] = pieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = false;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow;
currentPieceLocation[2][1] = pieceCol-1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow;
currentPieceLocation[3][1] = pieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 1;
}
else timeIndexer++;
}
}
void rotateL2(){
byte pieceRow = currentPieceLocation[3][0];
byte pieceCol = currentPieceLocation[3][1];
if(currentPieceOrientation == 3){
if(!board[pieceRow+2][pieceCol+1] && !board[pieceRow+1][pieceCol-1]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+2;
currentPieceLocation[0][1] = pieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow+2;
currentPieceLocation[1][1] = pieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow+2;
currentPieceLocation[2][1] = pieceCol+1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = true;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow+1;
currentPieceLocation[3][1] = pieceCol-1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 0;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 2){
if(!board[pieceRow+1][pieceCol-1] &&!board[pieceRow-1][pieceCol]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+1;
currentPieceLocation[0][1] = pieceCol-1;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = false;
hasCollisionDown[0] = true;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow+1;
currentPieceLocation[1][1] = pieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = false;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = false;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow;
currentPieceLocation[2][1] = pieceCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = false;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow-1;
currentPieceLocation[3][1] = pieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = true;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 3;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 1){
if(!board[pieceRow+1][pieceCol] && !board[pieceRow][pieceCol-2]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+1;
currentPieceLocation[0][1] = pieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow;
currentPieceLocation[1][1] = pieceCol-2;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = false;
hasCollisionDown[1] = true;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow;
currentPieceLocation[2][1] = pieceCol-1;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = false;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow;
currentPieceLocation[3][1] = pieceCol;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 2;
}
else timeIndexer++;
}
else if(currentPieceOrientation == 0){
if(!board[pieceRow-1][pieceCol-1] && !board[pieceRow-1][pieceCol]){
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = false;
currentPieceLocation[0][0] = pieceRow+1;
currentPieceLocation[0][1] = pieceCol;
board[currentPieceLocation[0][0]][currentPieceLocation[0][1]] = true;
hasCollisionRight[0] = true;
hasCollisionLeft[0] = true;
hasCollisionDown[0] = false;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = false;
currentPieceLocation[1][0] = pieceRow;
currentPieceLocation[1][1] = pieceCol;
board[currentPieceLocation[1][0]][currentPieceLocation[1][1]] = true;
hasCollisionRight[1] = true;
hasCollisionLeft[1] = true;
hasCollisionDown[1] = false;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = false;
currentPieceLocation[2][0] = pieceRow-1;
currentPieceLocation[2][1] = pieceCol;
board[currentPieceLocation[2][0]][currentPieceLocation[2][1]] = true;
hasCollisionRight[2] = true;
hasCollisionLeft[2] = false;
hasCollisionDown[2] = true;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = false;
currentPieceLocation[3][0] = pieceRow-1;
currentPieceLocation[3][1] = pieceCol+1;
board[currentPieceLocation[3][0]][currentPieceLocation[3][1]] = true;
hasCollisionRight[3] = false;
hasCollisionLeft[3] = true;
hasCollisionDown[3] = true;
currentPieceOrientation = 1;
}
else timeIndexer++;
}
}