Skip to content

Instantly share code, notes, and snippets.

@LarsEckart
Created June 25, 2022 12:22
Show Gist options
  • Save LarsEckart/988939f5336ae49944beb33a5ebf2777 to your computer and use it in GitHub Desktop.
Save LarsEckart/988939f5336ae49944beb33a5ebf2777 to your computer and use it in GitHub Desktop.
package com.example.chenformula;
public class ChenCalculator {
public static int calculate(String firstCard, String secondCard, boolean suited) {
double result = 0.0;
result += scoreHighestCardOnly(firstCard, secondCard);
if (isPair(firstCard, secondCard)) {
result = result * 2;
}
if (suited) {
result += 2;
}
result = result - pointsIfGapBetweenCards(firstCard, secondCard);
result += bonusPointIf0or1CardGapAndBothCardsLowerThanQ(firstCard, secondCard);
return Math.toIntExact(Math.round(result));
}
private static double scoreHighestCardOnly(String firstCard, String secondCard) {
return 0;
}
private static boolean isPair(String firstCard, String secondCard) {
return false;
}
private static int pointsIfGapBetweenCards(String firstCard, String secondCard) {
return 0;
}
private static int bonusPointIf0or1CardGapAndBothCardsLowerThanQ(String firstCard, String secondCard) {
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment