2017년 4월 21일 금요일

Need help making a counting game


Need the following counting game made meeting the following criteria if anyone could help would be great )

a. Welcome the player and ask the player for their name.
 b. If the player guesses incorrectly, the app should use the player’s name when stating the guess is incorrect: “Sorry, PLAYER’S NAME, that is not the correct answer.” 
c. If the player guesses incorrectly, the app should tell the player whether the correct number is higher or lower than the guess. 
d. Ask the player for the maximum number from which the player wishes to play. For example, instead of picking a random number from 1 to 10, ask the player what the maximum should be, and then pick a random number between 1 and what the player requested as the maximum. 
e. Keep a tally of the number of guesses it takes the player to guess the correct number. 
f. When the player guesses the correct number, using the player’s name, tell them congratulations and the number of guesses it took them.

--
We want you to have fun with App Inventor and learn to program.  Here are some resources to help you learn to use the AI2 tools  A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook   http://www.appinventor.org/book2 ... the links are at the bottom of the Web page.  The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles  

How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/howDoYou/eventHandling  .

Most of what you need to code your guessing game is in the use of IF..THEN statements ...you can read about them here : Chapter 18. Programming Your App to Make Decisions

-- 
you can try to understand this and complete it as you wish


Hey thanks for the help. I forgot to mention that we're not allowed to use loops.

"Note that there will be no loop in your code because event handling will be used"

How would you go upon completing the program that way?

-- 
follow the recommendation of SteveJG...
you should do your home work yourself instead of asking here for someone, who does the work four you...
note: your teacher might read this forum, too...

-- 
Do you know what a loop is Tom?    If you had read the Inventor's Guide, you would have found this: Chapter 20. Repeating Blocks

Is there anything like that in Rudolph's example?

Do you know what an event handler is?   It appears you might not have read: Chapter 14. Understanding an App's Architecture yet.

What is in Rudolph's example are plenty of conditional statements  like these: Chapter 18. Programming Your App to Make Decisions
Are those loops?

-- 
This problems sounds like a High-Low Binary Search
where at each step you use the player's answer (higher/lower)
to adjust the upper and lower bounds of the range that
you think must include the player's (app's?) target number.
At each step, you suggest the center value of the current range, and
shrink the size of the range by half, deciding which boundary to
move inwards based on the higher/lower response.

-- 

댓글 없음:

댓글 쓰기