//checks the player's responses //takes the player's responses and checks to see if they passed the test //gives reward/punishment based on reason, which tells which method called checkAnswer public void checkAnswer(String[] playerChoice) { //sets number correct to 0 int correct = 0; //increases correct if correct, decreases if incorrect //if correct > 0, player got best 2/3 or 3/5 for (int i = 0; i < playerChoice.Length; i++) { if (playerChoice[i].Equals(render.answers[i][4])) { correct++; } else { correct--; } } //resets render info to state where questions are not asked render.askQuestion = false; //resets messages to be displayed resetPop(); //if player won if (correct > 0) { switch (reason) { //player gets arrow case 1: player.updateInventory(1, 0); break; //player beat pit, returns to original room case 2: map.moveToInitial(); //displays message updatePop(4); break; //player beat Wumpus, moves wumpus away case 3: map.moveWumpusAway(); //displays message updatePop(6); break; //player recieves a secret case 4: updateSecret(); break; } //resets reason for checkAnswer reason = 0; } //if player lost else { switch (reason) { //ends game, 3 - due to pit case 2: endGame(3); break; //ends game, 4 - due to wumpus case 3: endGame(4); break; } } //removes gold for each question answered player.updateInventory(0, 0 - playerChoice.Length); //updates render for ui display updateRender(); }