From 400016b4648ee5689edeff6f675cb3d6a6636b9d Mon Sep 17 00:00:00 2001 From: g12934nm Date: Thu, 24 Apr 2014 13:02:46 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=9C=E3=83=9C=E3=83=83?= =?UTF-8?q?=E3=82=AF=E3=82=B9=E3=81=A7=E3=83=AC=E3=83=99=E3=83=AB=E3=82=92?= =?UTF-8?q?=E9=81=B8=E6=8A=9E=E3=81=99=E3=82=8B=E3=81=A8=E3=82=B7=E3=83=A3?= =?UTF-8?q?=E3=83=83=E3=83=95=E3=83=AB=E5=9B=9E=E6=95=B0=E3=81=8C=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../toy/anagrams/lib/StaticWordLibrary.java | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/com/toy/anagrams/lib/StaticWordLibrary.java b/src/com/toy/anagrams/lib/StaticWordLibrary.java index 93e286f..824a42d 100644 --- a/src/com/toy/anagrams/lib/StaticWordLibrary.java +++ b/src/com/toy/anagrams/lib/StaticWordLibrary.java @@ -31,6 +31,8 @@ package com.toy.anagrams.lib; +import java.util.Random; + /** * Implementation of the logic for the Anagram Game application. */ @@ -153,9 +155,38 @@ public String getWord(int idx) { * @param idx index of required word * @return word at that index in its scrambled form */ - public String getScrambledWord(int idx) { - return SCRAMBLED_WORD_LIST[idx]; - } + public String getScrambledWord(int idx, int count) { + //return SCRAMBLED_WORD_LIST[idx]; + String word = WORD_LIST[idx]; + char[] shuffle = new char[word.length()]; + + for(int i=0; i