Discussion:
Input from automarking
(too old to reply)
Suh Il-Min
2004-01-21 17:28:37 UTC
Permalink
Hi,

I've made my programs and now i have concerns about various faulty
inputs like numbers outside of min and max in guessing or string instead
of a character in hangman.
Can i assume that there will be only correct inputs or do i have to take
care of those possible faulty inputs?

Thanks.

Il-min
Greg Sinclair
2004-01-21 22:06:11 UTC
Permalink
I hope somone answers this, a TA preferably.

I have seen several posts asking these questions, but no answer. Any help?

-Greg
Post by Suh Il-Min
Hi,
I've made my programs and now i have concerns about various faulty
inputs like numbers outside of min and max in guessing or string instead
of a character in hangman.
Can i assume that there will be only correct inputs or do i have to take
care of those possible faulty inputs?
Thanks.
Il-min
Alexander Smith
2004-01-21 21:10:07 UTC
Permalink
Hi Il-min,

For lab 1, you can assume correct input. (In future labs, that may or may
not be the case. It will be stated in the handout.) "Correct input" for
lab 1 means the following:

For the hangman game:
- The user will enter a single word with no whitespace, and press enter.
- The user will the enter a series of guess. Each guess is a single
non-whitespace character followed by enter.
You have been provided with example files that show correct input. So, if
you run "./hangman < in1.txt", the result you get should exactly match
"out1.txt".

For the guessing game:
- For human_guess(), the human will always enter integers. Note that if
the human is not very smart, he/she may guess a number that is out of
range, or that he/she should "know" is too high or low from a previous
guess. That is ok - the program can still tell the user that the number is
too high or too low. (I.e., if the human enters -10023, then that is too
low.)
- For computer_guess(), the human will always enter a non-whitespace
character and press enter, but the character is not necessarily 'l', 'h',
or 'c'. (If it's not, then the comptuer should ask the question again -
see the lab handout.) It doesn't matter whether or not the human is
truthful. The way the game is designed, the computer is guaranteed
eventually to reach a state where the user enters 'c', or there is only
one possibility left.

For numerical integration:
You can assume that the value 'numP' is an accurate indication of the size
of the 'P' array.



Note that you will never be penalized for having too much error checking.
Under the above assumptions, I don't think there is any error checking
left to do, but if you find a case I haven't covered, go ahead and deal
with it. (I'm not the one marking the assignments - see the webpage for a
list of marking TAs.) We've tried to keep lab 1 fairly simple. For future
labs, we may require you to do more aggressive error checking.

Alexander
Post by Suh Il-Min
Hi,
I've made my programs and now i have concerns about various faulty
inputs like numbers outside of min and max in guessing or string instead
of a character in hangman.
Can i assume that there will be only correct inputs or do i have to take
care of those possible faulty inputs?
Thanks.
Il-min
Wilkie Wai Kei Tsang
2004-01-22 04:26:08 UTC
Permalink
Hi

I was wondering for the computer_guess() function, it is possible for the
computer to guess 1 or 100 from the result of our rand() function. If it
guesses 100 and the user inputs 'l' for too low then I will get a fatal
exception and the same case for entering 'h' for the guess 1.
Do we also have to make sure that if the user enters 'l' for 99 and 'h' for
2 we directly answer 100 and 1 respectively?
I'm sorry if I repeated this question, in that case can you refer me back to
a reply.

Wilkie

ps Sorry Alexander for replying to your email :p
Post by Alexander Smith
Hi Il-min,
For lab 1, you can assume correct input. (In future labs, that may or may
not be the case. It will be stated in the handout.) "Correct input" for
- The user will enter a single word with no whitespace, and press enter.
- The user will the enter a series of guess. Each guess is a single
non-whitespace character followed by enter.
You have been provided with example files that show correct input. So, if
you run "./hangman < in1.txt", the result you get should exactly match
"out1.txt".
- For human_guess(), the human will always enter integers. Note that if
the human is not very smart, he/she may guess a number that is out of
range, or that he/she should "know" is too high or low from a previous
guess. That is ok - the program can still tell the user that the number is
too high or too low. (I.e., if the human enters -10023, then that is too
low.)
- For computer_guess(), the human will always enter a non-whitespace
character and press enter, but the character is not necessarily 'l', 'h',
or 'c'. (If it's not, then the comptuer should ask the question again -
see the lab handout.) It doesn't matter whether or not the human is
truthful. The way the game is designed, the computer is guaranteed
eventually to reach a state where the user enters 'c', or there is only
one possibility left.
You can assume that the value 'numP' is an accurate indication of the size
of the 'P' array.
Note that you will never be penalized for having too much error checking.
Under the above assumptions, I don't think there is any error checking
left to do, but if you find a case I haven't covered, go ahead and deal
with it. (I'm not the one marking the assignments - see the webpage for a
list of marking TAs.) We've tried to keep lab 1 fairly simple. For future
labs, we may require you to do more aggressive error checking.
Alexander
Post by Suh Il-Min
Hi,
I've made my programs and now i have concerns about various faulty
inputs like numbers outside of min and max in guessing or string instead
of a character in hangman.
Can i assume that there will be only correct inputs or do i have to take
care of those possible faulty inputs?
Thanks.
Il-min
Loading...