Changed name to Full House

This commit is contained in:
2015-04-27 15:04:25 +02:00
parent e6cb8c4135
commit 0aa5bfdbfa

View File

@@ -21,7 +21,7 @@ public class PokerGame {
public int getScore(String hand) { public int getScore(String hand) {
int score = 0; int score = 0;
if (findPrison(hand) == true) if (findFullHouse(hand) == true)
score = 9; score = 9;
else if (findFourOfAKind(hand) == true) else if (findFourOfAKind(hand) == true)
score = 7; score = 7;
@@ -119,14 +119,14 @@ public class PokerGame {
} }
/** /**
* Finds a prison (kåk = prison). We have a prison if the first and last two * Finds a Full house. We have a Full House if the first and last two
* cards are a pair, and the middle card has same value as either of them * cards are a pair, and the middle card has same value as either of them
* (is three of a kind) * (is three of a kind)
* *
* @param hand * @param hand
* @return true if there is a prison, otherwise false * @return true if there is a Full House, otherwise false
*/ */
private boolean findPrison(String hand) { private boolean findFullHouse(String hand) {
char[] values = getValues(hand); char[] values = getValues(hand);
if (values[0] == values[1] && values[3] == values[4] if (values[0] == values[1] && values[3] == values[4]