Saturday, November 28, 2009 11:07 PM,



A student writes:



	 Hello, Prof. Patt!
	 
	 You've already sent out several emails about input for assignment 4, 
	 but I'm still not sure about when to stop taking a user's input if 
	 their move is invalid.  Currently I have my program set up to return 
	 an error message and ask for a new input if the first character 
	 entered is invalid. The second character is never entered (as long as 
	 the user is paying attention, at least) since it wouldn't matter anyway.
	 Is this alright, or will I lose points for not allowing the user for 
	 entering two characters, even if the first one is invalid?
	 
	 Thanks,
	 <<name withheld to protect one who probably did not see our example 
	 game>>



Did you look at the example game we provided?  You will note that the game 
program waits for the player to input both characters, row and number of rocks 
to remove.  Look, for example, at what happens if Player 2 entered G1.  
If you did it the way you suggest, the example would show (unless the player 
typed a row and then waited to type a number of rocks, even though the prompt 
suggests he should type in both row and number without waiting.

Player 2, choose a row and number of rocks: G Invalid move.  Try again.
Player 2, choose a row and number of rocks: 1

What I want you to do is have your program get the full move (two characters) 
before your program analyzes that move to see if it is valid.  Actually, it 
should be easier for you to do it the way I suggest.

And, yes, our grading program does expect your program to accept two 
characters of input before making the decision as to whether the move is 
invalid or not.

Good luck finishing it before Tuesday night just before midnight.

See you in class on Monday.

Yale Patt