   clearSquares();
   allGreen();
   delay(1000);
-  clearSquares();  
+  clearSquares(); 
+  
 }
 
 // the loop routine runs over and over again forever:
 void loop() {
-  adjustColors();
-  Serial.println(squares[7]->getColorValue());  
+  if (!redVictory && !greenVictory){
+    updateColorStatus();
+  }
+  
+  redVictory = checkWin(redStatus);
+  greenVictory = checkWin(greenStatus);
+ 
+  if (redVictory){
+    clearSquares();
+    allRed();
+  } else if (greenVictory){
+    clearSquares();
+    allGreen();
+  }
+  
+  //Serial.println();  
 }
+
 
 //The calibration changes from sensor to sensor
 void calibrateSensors(){

//int gameStatus = 0; //0 = ongoing game, 1 = you win, 2 = opponent wins
//int currentTurn = 0; //0 you, 1 opponent

void setup() {  
  Serial.begin(9600);
  for (int i = 0; i < 9; i++){

  }
}

void printStatus(){
  Serial.println("Red");
  for (int i=0; i < 9; i++){
    Serial.println(redStatus[i]);
  }
  Serial.println();
  
  Serial.println("Green");
  for (int i=0; i < 9; i++){
    Serial.println(greenStatus[i]);
  }
  Serial.println();
}


