All rights reserved by Nintendo, we do not own or claim rights to Pokemon, or any copyrights based on it.
HashMap<String, String> map = new HashMap<String, String>();
HashMap<String, String> map = new HashMap<String, String>();String[] keys = map.keySet().toArray(new String[map.size()]);
import java.util.ArrayList;import java.util.Collections;import java.util.HashMap;import java.util.Random;import java.util.Scanner;public class WordUnscrambler { public static void main(String[] args) { /* *1. Make an Array for a WordBank *2. Make an Array for each letter in the word bank *3. Scramble the words with a random generator *4. * * */ Scanner input = new Scanner(System.in); int score = 0; int points = 0; String guess; Random rand = new Random (); String[] wordbank = new String[4]; wordbank[0] = ("Boat"); wordbank[1] = ("Walk"); wordbank[2] = ("Mouse"); wordbank[3] = ("Liquid"); int numberOfTries = 0; String wordToGuess = wordbank[rand.nextInt(wordbank.length)]; boolean win = false; boolean overallwin = false; char[] boat = {'B','O','A','T'}; char[] walk = {'W','A','L','K'}; char[] mouse = {'M','O','U','S','E'}; char[] liquid = {'L','I','Q','U','I','D'}; ArrayList<Integer> number = new ArrayList<Integer>(); while (win == true){ for (int i = -1; i < wordToGuess.length() -1; i++){ number.add(i+1); } Collections.shuffle(number); if (number.get(0) == 1 && number.get(1) == 2 && number.get(2) == 3 && number.get(3) == 4){ Collections.shuffle(number); } } while (overallwin == false){ for (int i = -1; i < wordToGuess.length() -1; i++){ number.add(i+1); } Collections.shuffle(number); if (number.get(0) == 1 && number.get(1) == 2 && number.get(2) == 3 && number.get(3) == 4){ Collections.shuffle(number); } System.out.println("Unscramble the Word!"); //numberOfTries++; if (wordToGuess == "Boat"){ System.out.println(boat[number.get(0)] + "" + boat[number.get(1)] + "" + boat[number.get(2)] + "" + boat[number.get(3)]); guess = input.nextLine(); if (guess.equals(wordToGuess)){ win = true; points = 4; } } if(wordToGuess == "Walk"){ System.out.println(walk[number.get(0)] + "" + walk[number.get(1)] + "" + walk[number.get(2)] + "" + walk[number.get(3)]); guess = input.nextLine(); if (guess.equals(wordToGuess)){ win = true; points = 4; } } else if(wordToGuess == "Mouse"){ System.out.println(mouse[number.get(0)] + "" + mouse[number.get(1)] + "" + mouse[number.get(2)] + "" + mouse[number.get(3)] + "" + mouse[number.get(4)]); guess = input.nextLine(); if (guess.equals(wordToGuess)){ win = true; points = 5; } } else if(wordToGuess == "Liquid"){ System.out.println(liquid[number.get(0)] + "" + liquid[number.get(1)] + "" + liquid[number.get(2)] + "" + liquid[number.get(3)] + "" + liquid[number.get(4)] + "" + liquid[number.get(5)]); guess = input.nextLine(); if (guess.equals(wordToGuess)){ win = true; points = 6; } } if (win == true){ score = score + points; System.out.println("You Win! " + points + " points has been added to your Score. Your score is now " + score); for (int j = 0; j < points; j++){ number.remove(0); } wordToGuess = wordbank[rand.nextInt(wordbank.length)]; win = false; } else { overallwin = true; System.out.println("You Lose! Your final score was " + score ); } } } }
if (wordToGuess = "Boat")