Exemplo n.º 1
0
 private boolean IsEinPaschOderYatzy(Roll p_aRoll, int category) {
   int count = YatzyConstants.ONES;
   boolean isSomething = false;
   for (int i = YatzyConstants.ONES; i <= YatzyConstants.FOURS; i++) {
     if (p_aRoll.GetRollPoints(i) == p_aRoll.GetRollPoints(i - YatzyConstants.ONES)) {
       count++;
       isSomething = ((count >= 3) && (count == category));
     } else {
       count = 1;
     }
   }
   return isSomething;
 }
Exemplo n.º 2
0
  @Override
  public int getRollPointsWithCategoryIndex(Roll aRoll, int categoryIndex) {

    if (aRoll != null) {
      int inLine = YatzyConstants.ONES;
      for (int i = YatzyConstants.ONES; i <= YatzyConstants.FOURS; i++) {
        if ((aRoll.GetRollPoints(i - 1) + 1) == aRoll.GetRollPoints(i)) inLine++;
      }
      if (inLine == YatzyConstants.FOURS) {
        return YatzyConstants.SMALL_STRAIGHT_POINTS;
      } else {
        return YatzyConstants.ZERO;
      }
    }
    return YatzyConstants.ZERO;
  }