diff --git a/fassade/GameCycle.java b/fassade/GameCycle.java index 57a07b5..9b47649 100644 --- a/fassade/GameCycle.java +++ b/fassade/GameCycle.java @@ -1,28 +1,5 @@ package fassade; public class GameCycle { -// public class DiceRoll { -// public static boolean hasSmallStraight(int[] dice) { -// Arrays.sort(dice); -// for (int i = 0; i < dice.length - 3; i++) { -// if (dice[i] + 1 == dice[i + 1] && dice[i] + 2 == dice[i + 2] && dice[i] + 3 == dice[i + 3]) { -// return true; -// } -// } -// return false; -// } -// -// public static boolean hasLargeStraight(int[] dice) { -// Arrays.sort(dice); -// for (int i = 0; i < dice.length - 4; i++) { -// if (dice[i] + 1 == dice[i + 1] && dice[i] + 2 == dice[i + 2] && dice[i] + 3 == dice[i + 3] && dice[i] + 4 == dice[i + 4]) { -// return true; -// } -// } -// return false; -// } -// -// public static void main(String[] args) { -// int[] dice = {3, 1, 4, 2, 5};} -// } // example array System.out.println("Has small straight: " + hasSmallStraight(dice)); System.out.println("Has large straight: " + hasLargeStraight(dice)); }}```Here's how the code works:1. First, we sort the array of dice rolls in ascending order using `Arrays.sort()`.2. In the `hasSmallStraight()` method, we iterate through the sorted array and check if four consecutive numbers appear. We do this by checking if the current element plus 1, 2, and 3 are equal to the next three elements in the array. If we find a match, we return `true`.3. In the `hasLargeStraight()` method, we do a similar check, -} + +} \ No newline at end of file