title: Small Straight - Method
body: <p>I've been stuck on this method for a couple of days now. This method checks to see if the roll of 5 dice == a small straight. It works for some numbers. If I roll a </p>
  
  <blockquote>
    <p>1, 2, 4, 3, 6</p>
  </blockquote>
  
  <p>it will work. However, if I roll a </p>
  
  <blockquote>
    <p>1, 2, 4, 3, 3</p>
  </blockquote>
  
  <p>it will not work. I think it's because of the duplicate 3 in there. I need to move it to the end somehow.</p>
  
  <p>A small straight is when there are four consecutive die face values, such as 1, 2, 3, 4 or 3, 4, 5, 6. It can be in any order such as 2, 3, 1, 4</p>
  
  <pre><code>      int counter = 0;
        int score = 0;
        boolean found = false;
        Arrays.sort(die);
  
        for (int i = 0; i &lt; die.length - 1; i++)
        {
            if (counter == 3)
                found = true;
  
            if (die[i + 1] == die[i] + 1)
            {
                counter++;
            }
            else if (die[i + 1] == die[i])
            {
                continue;
            }
            else
            {
                counter = 0;
            }
        }
  
        if (found)
        {
           score = 30; 
        }
        else
        {
            score = 0;
        }
        return score;
      }
  </code></pre>