Discussion:
Question about auto marker...
(too old to reply)
Co Stephen
2004-01-20 19:05:01 UTC
Permalink
Hi,

I've made my hangman program so that it only reads 1 character guess
without the user pressing ENTER (\n). (i.e. The program reads the
character input right away into the buffer without detecting a newline
character). This is to prevent any witty chumps from entering a string
and then pressing ENTER to intentionally cause problems. I know that
under DOS/Windows environments, the functions to do this is already
there but under Linux it's a little wierd. I tried setting the using the
system function to set it to "cooked" and afterwards set it to "raw" but
that didn't work so I had to code an entire function to do that.

I assume that the automarker will input a string instead of a character
for that portion of the program as a boundary check. Due to my code's
nature, the string will automatically be read in character by character
(i.e. each character in the string becomes a guess). Would I lose marks
if the automarker fails in that sense? Or do I have to re-code it so
that when the user enters a string instead of a character, the program
would output to the screen a message telling them to re-enter a character?

Thanks,
S Co
Alexander Smith
2004-01-20 20:59:52 UTC
Permalink
Hi,

You're making things a lot more complicated than you need to for this lab.
For the hangman program for lab 1, you may assume that the user's input
will match what is stated in the handout. That is, the user will enter a
single character followed by enter for each guess.

I'm not sure which libraries you're refering to when you talk about "raw"
input, etc., but for this course, you should never need to use any special
system libraries, or anything that is not standard C. In fact, the
"Marking Guideline" on the "Lab/Exams" page states that you should NOT use
anything that is not part of the C standard. If what you've written works
differently under DOS/Windows than it does under UNIX or Linux, then you
have likely used some functions that you shouldn't have. You can do this
entire lab with printf() and scanf() without difficulty.

You may still theoretically get some minor differences in behaviour
between *NIX and Windows systems, because most UNIX systems line-buffer
I/O, but DOS/Windows does not. But, lab 1 has been written with this in
mind. The way we've specified the I/O for hangman and the guessing game,
this should not pose a problem.

Alexander
Post by Co Stephen
Hi,
I've made my hangman program so that it only reads 1 character guess
without the user pressing ENTER (\n). (i.e. The program reads the
character input right away into the buffer without detecting a newline
character). This is to prevent any witty chumps from entering a string
and then pressing ENTER to intentionally cause problems. I know that
under DOS/Windows environments, the functions to do this is already
there but under Linux it's a little wierd. I tried setting the using the
system function to set it to "cooked" and afterwards set it to "raw" but
that didn't work so I had to code an entire function to do that.
I assume that the automarker will input a string instead of a character
for that portion of the program as a boundary check. Due to my code's
nature, the string will automatically be read in character by character
(i.e. each character in the string becomes a guess). Would I lose marks
if the automarker fails in that sense? Or do I have to re-code it so
that when the user enters a string instead of a character, the program
would output to the screen a message telling them to re-enter a character?
Thanks,
S Co
Continue reading on narkive:
Loading...