title: show highest score
body: <p>I have a simple program that has a loop to create a timer, a beep starts the game and ends the game, there are 4 buttons so 4 players.</p>
  
  <p>I have a button click event that registers a click every time the button is clicked at the end I have a print out of all players clicks.</p>
  
  <p>I need a way to tell who got the most clicks so I can light a led up next to there button.</p>
  
  <p>Dose any one know how I could solve this problem code is bellow.</p>
  
  <p><strong><em>Code</em></strong></p>
  
  <pre><code>    const int  buttonPin = 7;    // the pin that the pushbutton is attached to
  const int  buttonPin2 = 6;    // the pin that the pushbutton is attached to
  const int  buttonPin3 = 4;    // the pin that the pushbutton is attached to
  const int  buttonPin4 = 3;    // the pin that the pushbutton is attached to
  const int ledPin = 13;       // the pin that the LED is attached to
  
  // Variables will change:
  int buttonPushCounter = 0;   // counter for the number of button presses
  int buttonState = 0;         // current state of the button
  int lastButtonState = 0;     // previous state of the button
  
  int buttonPushCounter2 = 0;   // counter for the number of button presses
  int buttonState2 = 0;         // current state of the button
  int lastButtonState2 = 0;     // previous state of the button
  
  int buttonPushCounter3 = 0;   // counter for the number of button presses
  int buttonState3 = 0;         // current state of the button
  int lastButtonState3 = 0;     // previous state of the button
  
  int buttonPushCounter4 = 0;   // counter for the number of button presses
  int buttonState4 = 0;         // current state of the button
  int lastButtonState4 = 0;     // previous state of the button
  
  boolean player1 = false;
  boolean player2 = false;
  boolean player3 = false;
  boolean player4 = false;
  
  
  int speakerOut = 5;
    int a = 0;
  
  void setup() {
    // initialize the button pin as a input:
    pinMode(buttonPin, INPUT);
    // initialize the LED as an output:
    pinMode(ledPin, OUTPUT);
    // initialize serial communication:
    Serial.begin(9600);
  }
  
  void loop() {
    // read the pushbutton input pin:
  
     a ++;
    Serial.println(a);
      analogWrite(speakerOut, NULL);
  
    if(a &gt; 50 &amp;&amp; a &lt; 300){
    analogWrite(speakerOut, 200);
    }
  
    if(a &lt;= 49){
      analogWrite(speakerOut, NULL);
    }
  
    if(a &gt;= 300 &amp;&amp; a &lt;= 2499){
        analogWrite(speakerOut, NULL);
    }
  
  if(a &gt; 300 &amp;&amp; a &lt; 2500){
  
    buttonState = digitalRead(buttonPin);
    buttonState2 = digitalRead(buttonPin2);
    buttonState3 = digitalRead(buttonPin3);
    buttonState4 = digitalRead(buttonPin4);
  
    // compare the buttonState to its previous state
    if (buttonState != lastButtonState) 
   {
      // if the state has changed, increment the counter
      if (buttonState == HIGH) {
        // if the current state is HIGH then the button
        // wend from off to on:
        buttonPushCounter++;
        Serial.println("on");
        Serial.print("number of button1 pushes:  ");
        Serial.println(buttonPushCounter);
      } 
      else {
        // if the current state is LOW then the button
        // wend from on to off:
        Serial.println("off"); 
      }
    }
     if (buttonState2 != lastButtonState2) 
   {
      // if the state has changed, increment the counter
      if (buttonState2 == HIGH) {
        // if the current state is HIGH then the button
        // wend from off to on:
        buttonPushCounter2++;
        Serial.println("on");
        Serial.print("number of button2 pushes:  ");
        Serial.println(buttonPushCounter2);
      } 
      else {
        // if the current state is LOW then the button
        // wend from on to off:
        Serial.println("off"); 
      }
    }
    if (buttonState3 != lastButtonState3) 
   {
      // if the state has changed, increment the counter
      if (buttonState3 == HIGH) {
        // if the current state is HIGH then the button
        // wend from off to on:
        buttonPushCounter3++;
        Serial.println("on");
        Serial.print("number of button3 pushes:  ");
        Serial.println(buttonPushCounter3);
      } 
      else {
        // if the current state is LOW then the button
        // wend from on to off:
        Serial.println("off"); 
      }
    }
    if (buttonState4 != lastButtonState4) 
   {
      // if the state has changed, increment the counter
      if (buttonState4 == HIGH) {
        // if the current state is HIGH then the button
        // wend from off to on:
        buttonPushCounter4++;
        Serial.println("on");
        Serial.print("number of button4 pushes:  ");
        Serial.println(buttonPushCounter4);
      } 
      else {
        // if the current state is LOW then the button
        // wend from on to off:
        Serial.println("off"); 
      }
    }
    // save the current state as the last state, 
    //for next time through the loop
    lastButtonState = buttonState;
    lastButtonState2 = buttonState2;
    lastButtonState3 = buttonState3;
    lastButtonState4 = buttonState4;
  
  }
  
  if(a &gt; 2500){
      analogWrite(speakerOut, 200);
  
  }
  
  if (a &gt; 2700){
        analogWrite(speakerOut, NULL);
  
  // below is a print out of click by each player
      Serial.print("player 1 clicks = ");
      Serial.println(buttonPushCounter);
  
      Serial.print("player 2 clicks = ");
      Serial.println(buttonPushCounter2);
  
      Serial.print("player 3 clicks = ");
      Serial.println(buttonPushCounter3);
  
      Serial.print("player 4 clicks = ");
      Serial.println(buttonPushCounter4);
  
     // if(buttonPushCounter &gt; buttonPushCounter2 || buttonPushCounter &gt; buttonPushCounter3 || buttonPushCounter &gt; buttonPushCounter4){
     //   player1 = true;
     // }
      //if(buttonPushCounter2 &gt; buttonPushCounter || ..... ){
      //  player2 = true;
      //}
  
     // Serial.print("The two players with the highest scores are player... ");   
  }
  }
  </code></pre>
  
  <p>so what I need is a way to tell who got the most clicks </p>