Created
June 25, 2022 12:22
-
-
Save LarsEckart/988939f5336ae49944beb33a5ebf2777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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