Example #1
0
 //returns a TwoTuple of items that make up the near straight
 //and a List of the poistions which need to be removed
 public TwoTuple<int, List<int>> straightToTuple()
 {
     TwoTuple<int, List<int>> result = new TwoTuple<int, List<int>>(0, new List<int>());
     //loop through all the cards and see which one has the highest straight
     //result is the first one we come by that is the greatest
     for (int i = 0; i < 5; ++i)
     {
         int straightCheck = hand[i].value;
         int numStraight = 0;
         List<int> positions = new List<int>();
         for (int j = 0; j < 5; ++j)
         {
             //if the card is within four, than it could be apart of a straight.
             if (hand[j].value <= straightCheck && hand[j].value >= straightCheck - 4)
                 ++numStraight;
             else
                 positions.Add(j);
         }
         if (numStraight > result.getFirst())
         {
             result.setFirst(numStraight);
             result.setSecond(positions);
         }
     }
     return result;
 }