{"action":"created","comment":{"url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/comments/81979851","pull_request_review_id":2919294,"id":81979851,"diff_hunk":"@@ -32,75 +34,100 @@\n     private IQuizStageListener handler;\n     private Label quizLabel;\n     private Emoji emoji;\n-    private String guess1, guess2, guess3;\n+    private Word guess1, guess2, guess3;\n+    private List<Word> collectedWords;\n+    private Word chosenWord;\n+    private int wordCategory;\n \n     //    Components\n     private TextButton guess1Button, guess2Button, guess3Button;\n     private Table parentTable, buttonTable;\n+    private List<Word> guesses;\n+    private WordLoader wordLoader;\n \n     private static final float TEXT_BUTTON_PADDING = 5.0f;\n     private static final float PARENT_TABLE_WIDTH = 600.0f, PARENT_TABLE_HEIGHT = 370.0f;\n     private static final float PARENT_TABLE_POS_X = 100.0f, PARENT_TABLE_POS_Y = 50.0f;\n     private static final float ROW_PADDING = 20.0f;\n \n-    public QuizStage(IQuizStageListener handler, List<Word> possibleWords) {\n+    public QuizStage(IQuizStageListener handler, List<Word> collectedWords) {\n         super(new FitViewport(InfinityRun.WIDTH, InfinityRun.HEIGHT));\n         this.handler = handler;\n+        this.collectedWords = collectedWords;\n \n         skin = new Skin(Gdx.files.internal(\"skin/uiskin.json\"));\n         quizLabel = new Label(\"Quiz-dags!\", skin);\n+        wordLoader = new WordLoader();\n+        wordCategory = collectedWords.get(0).getCategory();\n \n-        Random random = new Random();\n-\n-//        Temporary strings and emoji\n-        guess1 = \"Banan\";\n-        guess2 = \"Äpple\";\n-        guess3 = \"Päron\";\n-\n-//        TODO: FIX THIS MESS\n-        WordRandomizer emojiRandomizer = new WordRandomizer(new WordLoader().getWordsFromCategory(1));\n-        Word word = emojiRandomizer.getNext();\n-        emoji = new Emoji(word);\n-        /*\n-        *   In near future guess-strings should be changed to emojis.\n-        *   Check if emoji.getName() == chosenGuess.getName()\n-        */\n-\n-        createButtons();\n+        guesses = getRandomGuesses(collectedWords);\n+        emoji = new Emoji(guesses.get(0));\n+        createButtons(guesses);\n         createTableUi();\n         addActor(parentTable);\n         Gdx.input.setInputProcessor(this);\n     }\n \n-    private void randomizeWords() {\n-\n+    private List<Word> getRandomGuesses(List<Word> collectedWords) {\n+        Random random = new Random();\n+        List<Word> returnList = new ArrayList<Word>();\n+        while (returnList.size() < 3) {\n+            if (collectedWords.size() > 0) {\n+                int index = random.nextInt((collectedWords.size() - 1) + 1);\n+                if (!returnList.contains(collectedWords.get(index))) {\n+                    returnList.add(collectedWords.get(index));\n+                }\n+                collectedWords.remove(index);\n+            }\n+            else {\n+                List<Word> wordsFromCategory = wordLoader.getWordsFromCategory(wordCategory);\n+                int index = random.nextInt((wordsFromCategory.size() - 1) + 1);\n+                if (!returnList.contains(wordsFromCategory.get(index))) {\n+                    returnList.add(wordsFromCategory.get(index));\n+                }\n+            }\n+        }\n+        return returnList;\n     }\n \n-    private void createButtons() {\n-        guess1Button = new TextButton(guess1 + \"?\", skin);\n+    private void createButtons(List<Word> guesses) {","path":"core/src/com/teamturtle/infinityrun/stages/QuizStage.java","position":99,"original_position":99,"commit_id":"253755ee3de4cac970cd2599caddee54641f2a85","original_commit_id":"253755ee3de4cac970cd2599caddee54641f2a85","user":{"login":"Ostmos","id":14092882,"avatar_url":"https://avatars.githubusercontent.com/u/14092882?v=3","gravatar_id":"","url":"https://api.github.com/users/Ostmos","html_url":"https://github.com/Ostmos","followers_url":"https://api.github.com/users/Ostmos/followers","following_url":"https://api.github.com/users/Ostmos/following{/other_user}","gists_url":"https://api.github.com/users/Ostmos/gists{/gist_id}","starred_url":"https://api.github.com/users/Ostmos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ostmos/subscriptions","organizations_url":"https://api.github.com/users/Ostmos/orgs","repos_url":"https://api.github.com/users/Ostmos/repos","events_url":"https://api.github.com/users/Ostmos/events{/privacy}","received_events_url":"https://api.github.com/users/Ostmos/received_events","type":"User","site_admin":false},"body":"Inget måste dock!","created_at":"2016-10-05T14:06:49Z","updated_at":"2016-10-05T14:06:49Z","html_url":"https://github.com/ericwenn/TeamTurtle/pull/34#discussion_r81979851","pull_request_url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/comments/81979851"},"html":{"href":"https://github.com/ericwenn/TeamTurtle/pull/34#discussion_r81979851"},"pull_request":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34","id":88082871,"html_url":"https://github.com/ericwenn/TeamTurtle/pull/34","diff_url":"https://github.com/ericwenn/TeamTurtle/pull/34.diff","patch_url":"https://github.com/ericwenn/TeamTurtle/pull/34.patch","issue_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/34","number":34,"state":"open","locked":false,"title":"Quiz Fix","user":{"login":"dasovm","id":10012148,"avatar_url":"https://avatars.githubusercontent.com/u/10012148?v=3","gravatar_id":"","url":"https://api.github.com/users/dasovm","html_url":"https://github.com/dasovm","followers_url":"https://api.github.com/users/dasovm/followers","following_url":"https://api.github.com/users/dasovm/following{/other_user}","gists_url":"https://api.github.com/users/dasovm/gists{/gist_id}","starred_url":"https://api.github.com/users/dasovm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dasovm/subscriptions","organizations_url":"https://api.github.com/users/dasovm/orgs","repos_url":"https://api.github.com/users/dasovm/repos","events_url":"https://api.github.com/users/dasovm/events{/privacy}","received_events_url":"https://api.github.com/users/dasovm/received_events","type":"User","site_admin":false},"body":"### Quiz now works!!","created_at":"2016-10-05T13:57:28Z","updated_at":"2016-10-05T14:06:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55b3784d8bcc8e5674f933c1e96097e43ff3cc03","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34/commits","review_comments_url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34/comments","review_comment_url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/34/comments","statuses_url":"https://api.github.com/repos/ericwenn/TeamTurtle/statuses/253755ee3de4cac970cd2599caddee54641f2a85","head":{"label":"ericwenn:feature--quizhotfix","ref":"feature--quizhotfix","sha":"253755ee3de4cac970cd2599caddee54641f2a85","user":{"login":"ericwenn","id":5495697,"avatar_url":"https://avatars.githubusercontent.com/u/5495697?v=3","gravatar_id":"","url":"https://api.github.com/users/ericwenn","html_url":"https://github.com/ericwenn","followers_url":"https://api.github.com/users/ericwenn/followers","following_url":"https://api.github.com/users/ericwenn/following{/other_user}","gists_url":"https://api.github.com/users/ericwenn/gists{/gist_id}","starred_url":"https://api.github.com/users/ericwenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericwenn/subscriptions","organizations_url":"https://api.github.com/users/ericwenn/orgs","repos_url":"https://api.github.com/users/ericwenn/repos","events_url":"https://api.github.com/users/ericwenn/events{/privacy}","received_events_url":"https://api.github.com/users/ericwenn/received_events","type":"User","site_admin":false},"repo":{"id":68304280,"name":"TeamTurtle","full_name":"ericwenn/TeamTurtle","owner":{"login":"ericwenn","id":5495697,"avatar_url":"https://avatars.githubusercontent.com/u/5495697?v=3","gravatar_id":"","url":"https://api.github.com/users/ericwenn","html_url":"https://github.com/ericwenn","followers_url":"https://api.github.com/users/ericwenn/followers","following_url":"https://api.github.com/users/ericwenn/following{/other_user}","gists_url":"https://api.github.com/users/ericwenn/gists{/gist_id}","starred_url":"https://api.github.com/users/ericwenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericwenn/subscriptions","organizations_url":"https://api.github.com/users/ericwenn/orgs","repos_url":"https://api.github.com/users/ericwenn/repos","events_url":"https://api.github.com/users/ericwenn/events{/privacy}","received_events_url":"https://api.github.com/users/ericwenn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericwenn/TeamTurtle","description":null,"fork":false,"url":"https://api.github.com/repos/ericwenn/TeamTurtle","forks_url":"https://api.github.com/repos/ericwenn/TeamTurtle/forks","keys_url":"https://api.github.com/repos/ericwenn/TeamTurtle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericwenn/TeamTurtle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericwenn/TeamTurtle/teams","hooks_url":"https://api.github.com/repos/ericwenn/TeamTurtle/hooks","issue_events_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/events{/number}","events_url":"https://api.github.com/repos/ericwenn/TeamTurtle/events","assignees_url":"https://api.github.com/repos/ericwenn/TeamTurtle/assignees{/user}","branches_url":"https://api.github.com/repos/ericwenn/TeamTurtle/branches{/branch}","tags_url":"https://api.github.com/repos/ericwenn/TeamTurtle/tags","blobs_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericwenn/TeamTurtle/statuses/{sha}","languages_url":"https://api.github.com/repos/ericwenn/TeamTurtle/languages","stargazers_url":"https://api.github.com/repos/ericwenn/TeamTurtle/stargazers","contributors_url":"https://api.github.com/repos/ericwenn/TeamTurtle/contributors","subscribers_url":"https://api.github.com/repos/ericwenn/TeamTurtle/subscribers","subscription_url":"https://api.github.com/repos/ericwenn/TeamTurtle/subscription","commits_url":"https://api.github.com/repos/ericwenn/TeamTurtle/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericwenn/TeamTurtle/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericwenn/TeamTurtle/contents/{+path}","compare_url":"https://api.github.com/repos/ericwenn/TeamTurtle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericwenn/TeamTurtle/merges","archive_url":"https://api.github.com/repos/ericwenn/TeamTurtle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericwenn/TeamTurtle/downloads","issues_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues{/number}","pulls_url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls{/number}","milestones_url":"https://api.github.com/repos/ericwenn/TeamTurtle/milestones{/number}","notifications_url":"https://api.github.com/repos/ericwenn/TeamTurtle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericwenn/TeamTurtle/labels{/name}","releases_url":"https://api.github.com/repos/ericwenn/TeamTurtle/releases{/id}","deployments_url":"https://api.github.com/repos/ericwenn/TeamTurtle/deployments","created_at":"2016-09-15T15:04:00Z","updated_at":"2016-09-28T14:39:41Z","pushed_at":"2016-10-05T13:57:28Z","git_url":"git://github.com/ericwenn/TeamTurtle.git","ssh_url":"git@github.com:ericwenn/TeamTurtle.git","clone_url":"https://github.com/ericwenn/TeamTurtle.git","svn_url":"https://github.com/ericwenn/TeamTurtle","homepage":null,"size":8418,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"ericwenn:develop","ref":"develop","sha":"0c80c86620d67d25d7e315bfc0f35585b47e9d82","user":{"login":"ericwenn","id":5495697,"avatar_url":"https://avatars.githubusercontent.com/u/5495697?v=3","gravatar_id":"","url":"https://api.github.com/users/ericwenn","html_url":"https://github.com/ericwenn","followers_url":"https://api.github.com/users/ericwenn/followers","following_url":"https://api.github.com/users/ericwenn/following{/other_user}","gists_url":"https://api.github.com/users/ericwenn/gists{/gist_id}","starred_url":"https://api.github.com/users/ericwenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericwenn/subscriptions","organizations_url":"https://api.github.com/users/ericwenn/orgs","repos_url":"https://api.github.com/users/ericwenn/repos","events_url":"https://api.github.com/users/ericwenn/events{/privacy}","received_events_url":"https://api.github.com/users/ericwenn/received_events","type":"User","site_admin":false},"repo":{"id":68304280,"name":"TeamTurtle","full_name":"ericwenn/TeamTurtle","owner":{"login":"ericwenn","id":5495697,"avatar_url":"https://avatars.githubusercontent.com/u/5495697?v=3","gravatar_id":"","url":"https://api.github.com/users/ericwenn","html_url":"https://github.com/ericwenn","followers_url":"https://api.github.com/users/ericwenn/followers","following_url":"https://api.github.com/users/ericwenn/following{/other_user}","gists_url":"https://api.github.com/users/ericwenn/gists{/gist_id}","starred_url":"https://api.github.com/users/ericwenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericwenn/subscriptions","organizations_url":"https://api.github.com/users/ericwenn/orgs","repos_url":"https://api.github.com/users/ericwenn/repos","events_url":"https://api.github.com/users/ericwenn/events{/privacy}","received_events_url":"https://api.github.com/users/ericwenn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ericwenn/TeamTurtle","description":null,"fork":false,"url":"https://api.github.com/repos/ericwenn/TeamTurtle","forks_url":"https://api.github.com/repos/ericwenn/TeamTurtle/forks","keys_url":"https://api.github.com/repos/ericwenn/TeamTurtle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ericwenn/TeamTurtle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ericwenn/TeamTurtle/teams","hooks_url":"https://api.github.com/repos/ericwenn/TeamTurtle/hooks","issue_events_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/events{/number}","events_url":"https://api.github.com/repos/ericwenn/TeamTurtle/events","assignees_url":"https://api.github.com/repos/ericwenn/TeamTurtle/assignees{/user}","branches_url":"https://api.github.com/repos/ericwenn/TeamTurtle/branches{/branch}","tags_url":"https://api.github.com/repos/ericwenn/TeamTurtle/tags","blobs_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/refs{/sha}","trees_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ericwenn/TeamTurtle/statuses/{sha}","languages_url":"https://api.github.com/repos/ericwenn/TeamTurtle/languages","stargazers_url":"https://api.github.com/repos/ericwenn/TeamTurtle/stargazers","contributors_url":"https://api.github.com/repos/ericwenn/TeamTurtle/contributors","subscribers_url":"https://api.github.com/repos/ericwenn/TeamTurtle/subscribers","subscription_url":"https://api.github.com/repos/ericwenn/TeamTurtle/subscription","commits_url":"https://api.github.com/repos/ericwenn/TeamTurtle/commits{/sha}","git_commits_url":"https://api.github.com/repos/ericwenn/TeamTurtle/git/commits{/sha}","comments_url":"https://api.github.com/repos/ericwenn/TeamTurtle/comments{/number}","issue_comment_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/comments{/number}","contents_url":"https://api.github.com/repos/ericwenn/TeamTurtle/contents/{+path}","compare_url":"https://api.github.com/repos/ericwenn/TeamTurtle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ericwenn/TeamTurtle/merges","archive_url":"https://api.github.com/repos/ericwenn/TeamTurtle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ericwenn/TeamTurtle/downloads","issues_url":"https://api.github.com/repos/ericwenn/TeamTurtle/issues{/number}","pulls_url":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls{/number}","milestones_url":"https://api.github.com/repos/ericwenn/TeamTurtle/milestones{/number}","notifications_url":"https://api.github.com/repos/ericwenn/TeamTurtle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ericwenn/TeamTurtle/labels{/name}","releases_url":"https://api.github.com/repos/ericwenn/TeamTurtle/releases{/id}","deployments_url":"https://api.github.com/repos/ericwenn/TeamTurtle/deployments","created_at":"2016-09-15T15:04:00Z","updated_at":"2016-09-28T14:39:41Z","pushed_at":"2016-10-05T13:57:28Z","git_url":"git://github.com/ericwenn/TeamTurtle.git","ssh_url":"git@github.com:ericwenn/TeamTurtle.git","clone_url":"https://github.com/ericwenn/TeamTurtle.git","svn_url":"https://github.com/ericwenn/TeamTurtle","homepage":null,"size":8418,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34"},"html":{"href":"https://github.com/ericwenn/TeamTurtle/pull/34"},"issue":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/34"},"comments":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/ericwenn/TeamTurtle/statuses/253755ee3de4cac970cd2599caddee54641f2a85"}}}}
{"actor":{"display_login":"Ostmos"}}