csci 10 :: programming challenge 4 (due mon, feb 22)
For this programming challenge you will implement a simple number guessing game. The program will
generate a random number between 1 and 100, and the user will be given 10 tries to guess that number.
Format your documentation and HLA source code using hla_starter.txt
as a style guide.
Write, compile, and execute a complete HLA program that does the following:
[35 points] contains a procedure named getUns32 that robustly (i.e., does not crash on bad input)
reads in an uns32 value from the keyboard using a loop and try...exception block to prevent crashing and
guarantee a good input; @forward declare the procedure
[15 points] declares one (1) uns8 variable, to represent the number of guesses the user has taken and two (2)
uns32 variables, one to hold the randomly generated number, the other to hold the user's guess
[15 points] calls HLA's standard library rand.randomize to seed the random number generator and
calls HLA's standard library rand.urange to randomly generate a value between 1 and 100
[25 points] uses a loop to give the user a maximum of 10 guesses to match the random number, and outputs
appropriate messages (too high, too low, match) based on comparisons of the user's number against the
[15 points] for each user guess, the program displays which guess the user is on (e.g., "You are on guess 4 of 10")
and then prompts for and reads in the user's guess
- [15 points] calls the custom procedure getUns32 to get the user's input
[15 points] if the user fails to match the random number, the program should display the random number for the
user to see
[15 points] allows the user to play the game again (using a loop to repeat the program) if the user chooses
to do so
WARNING: if your code will not compile you will get a zero (0) on the assignment.
Submitting your work:
Email your .hla file only (do NOT send the .exe) to me at email@example.com.
Total points for this challenge: