# The Game Hurkle, convert it for running in SWING with more graphical feedback

## Sample Answer for The Game Hurkle, convert it for running in SWING with more graphical feedback Included After Question

The Game Hurkle, convert it for running in SWING with more graphical feedback

### The Game Hurkle

This week’s project is based on the game “Hurkle”. There are many variations of this game, and the version you will work on for your project is a one-dimensional version of it. The Hurkle is an imaginary creature that hides somewhere in a one-dimensional 1×10 integer game-space. Each time the game is run, the program places the Hurkle at a random position (0 through 10) in the game-and the player has a maximum of three (3) guesses to guess the Hurkle s location. The Hurkle does not move during the game. If the player finds the Hurkle, the program reports success and ends. If the player does not find the Hurkle the program gives a hint about what direction to move to find the Hurkle. There are two possible hints: right, or left.

The given version of the program is a console-based version (meaning the inputs and outputs happen on the console display). Run this code for the game Hurkle to see how it executes. It works well in the console but your job is to convert it for running in SWING with more graphical feedback for the user.You job is to experiment with the given code, and then adapt it by incorporating SWING features, such that the inputs and outputs will be more GUI-oriented, rather than console oriented. We’ve used SWING features in several programs already (in the lectures) and earlier project assignments, so you may want to review your textbook reading and the code examples in the week that use SWING.

Have fun, and don’t hesitate to ask questions.

import java.util.Random;

import java.util.Scanner;

publicclass Hurkle

{

publicstaticvoid main(String[] args) {

// TODO Auto-generated method stub

// gets user input for the keyboard

Scanner input = new Scanner(System.in);

//Gets a random number between 0 and 1

Random ran = newRandom();

//variable to hold the users’ guess

finalint LIMIT = 10;

//variable to hold the system random number

int rGuess;

rGuess = ran.nextInt(LIMIT);

// Here we are creating an array of one character strings into a String variable named ‘display’

String[] display ={“0″,”1″,”2″,”3″,”4″,”5″,”6″,”7″,”8″,”9″,”10”};

System.out.println(“You get 3 tries to win!”);

// Tell the user how many tries they will get

for(int tries = 0; tries < 3; tries++) {

//ask the user for a guess

System.out.println(“What is your number guess?” + ‘\n’);

//using the scanner class, get the user guess

System.out.print(“Bingo, you win!” + ‘\n’);

tries = 9999; // 9999 is used because it is so far out of bounds it has to get out of the game

} else if (usersAnswer < rGuess){

// replace the user guessed number with feedback: greater than, this is saving the feedback

} else{ // so it doesn’t get lost for the user

// replace the user guessed number with feedback: less than

}

// Display the number line with feedback

System.out.print(“Feedback : “);

for(int i=0;i<display.length;i++){

System.out.print( display[i] + ” ” );

}

} // end of for loop for the game

System.out.println(‘\n’);

System.out.println( “Game Over, 3 tries you lose! The number was ” + rGuess); // 3 tries you lose

}

}

### Submission Details:

• original work and image of completion
• Embed the two programs in a Microsoft Word document with a description of your programming strategy.

## Title: The Game Hurkle, convert it for running in SWING with more graphical feedback

### Lopes Write Policy

For assignments that need to be submitted to Lopes Write, please be sure you have received your report and Similarity Index (SI) percentage BEFORE you do a “final submit” to me.

Once you have received your report, please review it. This report will show you grammatical, punctuation, and spelling errors that can easily be fixed. Take the extra few minutes to review instead of getting counted off for these mistakes.

Review your similarities. Did you forget to cite something? Did you not paraphrase well enough? Is your paper made up of someone else’s thoughts more than your own?

Visit the Writing Center in the Student Success Center, under the Resources tab in LoudCloud for tips on improving your paper and SI score.

### Late Policy

The university’s policy on late assignments is 10% penalty PER DAY LATE. This also applies to late DQ replies.

Please communicate with me if you anticipate having to submit an assignment late. I am happy to be flexible, with advance notice. We may be able to work out an extension based on extenuating circumstances.

If you do not communicate with me before submitting an assignment late, the GCU late policy will be in effect.

I do not accept assignments that are two or more weeks late unless we have worked out an extension.

As per policy, no assignments are accepted after the last day of class. Any assignment submitted after midnight on the last day of class will not be accepted for grading.

### Communication

Communication is so very important. There are multiple ways to communicate with me:

Questions to Instructor Forum: This is a great place to ask course content or assignment questions. If you have a question, there is a good chance one of your peers does as well. This is a public forum for the class.

Individual Forum: This is a private forum to ask me questions or send me messages. This will be checked at least once every 24 hours.

### Welcome to class

Hello class and welcome to the class and I will be your instructor for this course. This is a -week course and requires a lot of time commitment, organization, and a high level of dedication. Please use the class syllabus to guide you through all the assignments required for the course. I have also attached the classroom policies to this announcement to know your expectations for this course. Please review this document carefully and ask me any questions if you do. You could email me at any time or send me a message via the “message” icon in halo if you need to contact me. I check my email regularly, so you should get a response within 24 hours. If you have not heard from me within 24 hours and need to contact me urgently, please send a follow up text to

Please, be advised I do NOT accept any assignments by email. If you are having technical issues with uploading an assignment, contact the technical department and inform me of the issue. If you have any issues that would prevent you from getting your assignments to me by the deadline, please inform me to request a possible extension. Note that working fulltime or overtime is no excuse for late assignments. There is a 5%-point deduction for every day your assignment is late. This only applies to approved extensions. Late assignments will not be accepted.

If you think you would be needing accommodations due to any reasons, please contact the appropriate department to request accommodations.

Plagiarism is highly prohibited. Please ensure you are citing your sources correctly using APA 7th edition. All assignments including discussion posts should be formatted in APA with the appropriate spacing, font, margin, and indents. Any papers not well formatted would be returned back to you, hence, I advise you review APA formatting style. I have attached a sample paper in APA format and will also post sample discussion responses in subsequent announcements.

I understand this is a lot of information to cover in 5 weeks, however, the Bible says in Philippians 4:13 that we can do all things through Christ that strengthens us. Even in times like this, we are encouraged by God’s word that we have that ability in us to succeed with His strength. I pray that each and every one of you receives strength for this course and life generally as we navigate through this pandemic that is shaking our world today. Relax and enjoy the course!

Hi Class,

Please read through the following information on writing a Discussion question response and participation posts.

Contact me if you have any questions.

### Important information on Writing a Discussion Question

• Your response needs to be a minimum of 150 words (not including your list of references)
• There needs to be at least TWO references with ONE being a peer reviewed professional journal article.
• Include in-text citations in your response
• Do not include quotes—instead summarize and paraphrase the information
• Points will be deducted if the above is not followed

### Participation –replies to your classmates or instructor

• A minimum of 6 responses per week, on at least 3 days of the week.
• Each response needs at least ONE reference with citations—best if it is a peer reviewed journal article
• Each response needs to be at least 75 words in length (does not include your list of references)
• Responses need to be substantive by bringing information to the discussion or further enhance the discussion. Responses of “I agree” or “great post” does not count for the word count.