   Serial.print("  P2: ");
   Serial.println(p2Score);
 }
+
+void checkForWinner()
+{
+  if ((p1Score >= 11 || p2Score >= 11) && abs(p1Score - p2Score) >= 2) {
+
+    Serial.print("*** WINNER ***   ");
+    if (p1Score > p2Score) {
+      Serial.print("P1");
+    } else {
+      Serial.print("P2");
+    }
+    Serial.println("   *** WINNER ***");
+    
+    resetGame();
+    showScore();
+  }
+}
+
+void resetGame()
+{
+  p1Score = 0;
+  p2Score = 0;
+  gameOver = 0;
+}

    if (p2State == LOW) {
      p2Score++;
      showScore();
    }
  }
  lastp2State = p2State;

const int p1Pin = 2;
const int p2Pin = 3;

int p1Score = 0;
int p2Score = 0;

