Question: JAVA CODING HELP - Trying to Code the game of RISK and have come to the point of Combat. How would I allow combat between
JAVA CODING HELP - Trying to Code the game of RISK and have come to the point of Combat. How would I allow combat between armies firstly, and implement a skip option for the users. Fortify option required also. Just looking for some ideas. 
//GAMEPLAY CLASS public static int throwDice() { // Generates a random number between 1 - 6 Random rand = new Random(); return rand.nextInt(6)+1; } public static void playDiceRoll() { try { Clip dice = AudioSystem.getClip(); AudioInputStream input = AudioSystem.getAudioInputStream(GamePlay.class.getResourceAsStream("diceRoll.wav")); dice.open(input); dice.start(); } catch (Exception e) { e.printStackTrace(); } } public String drawCard() { if(TERRITORY_CARDS.isEmpty()){ return "No more cards"; } else { // Chooses a random number between 0 and the REMAINING_COUNTRIES Random rand = new Random(); int cardNum = rand.nextInt(REMAINING_COUNTRIES); // Store the selected country in a temporary string String cardCountry = TERRITORY_CARDS.get(cardNum); String cardType = TERRITORY_TYPE.get(cardNum); this.cardCountry = cardCountry; this.cardType = cardType; TERRITORY_CARDS.remove(cardNum); // Remove the selected country from the deck TERRITORY_TYPE.remove(cardNum); REMAINING_COUNTRIES--; // Update the size of the deck return "[" + getCardCountry() + " -> " + getCardType() + "]"; } }Roll a dice each to see who takes the first turn. Highest roll does first. Re-roll if a draw. Inform the user. Allow the players to play a series of reduced turns. The turns do not include getting or exchanging territory cards: Calculate the number of reinforcements that a user gets based on the number of occupied countries and continents. Inform the user. Allow users to place their reinforcements on their territories. Update the map after every update. Provide error messages and allow re-entry of instructions, as appropriate. Ensure that all reinforcements are placed. Allow combat between armies. Combat takes place according to the rules of Risk. When the user does not want a further attack, the user may enter the command "skip. Allow users to fortify their positions after combat according to the rules of Risk. If the user does not want to fortify, the user may enter the command "skip". If a neutral player's armies are eliminated, the app must deal with them not having a turn. If the other human player's armies are eliminated, the app should display the name of the winner and a game over message. The user should receive appropriate error messages if their commands are invalid. o . Roll a dice each to see who takes the first turn. Highest roll does first. Re-roll if a draw. Inform the user. Allow the players to play a series of reduced turns. The turns do not include getting or exchanging territory cards: Calculate the number of reinforcements that a user gets based on the number of occupied countries and continents. Inform the user. Allow users to place their reinforcements on their territories. Update the map after every update. Provide error messages and allow re-entry of instructions, as appropriate. Ensure that all reinforcements are placed. Allow combat between armies. Combat takes place according to the rules of Risk. When the user does not want a further attack, the user may enter the command "skip. Allow users to fortify their positions after combat according to the rules of Risk. If the user does not want to fortify, the user may enter the command "skip". If a neutral player's armies are eliminated, the app must deal with them not having a turn. If the other human player's armies are eliminated, the app should display the name of the winner and a game over message. The user should receive appropriate error messages if their commands are invalid. o
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
