Now the game will re-prompt the player if invalid input is entered both for the level and for the move. The way it was fixed is described in the thanks-for-fixes.md file but here is a summary of the previous problem and the fix. If one entered an invalid level it proceeded to prompt for the move. Thus if one entered '.' or anything other than a number it would still move on. As for the move if one entered invalid input it would prompt again but in an infinite loop, not letting one enter anything and instead flooding the screen. The format specifier was thus a '%d'. Now it's a '%2s' on a 'char A[100]'. After the scanf() it uses atoi(). For the level it checks if > 10 || < 0 || !isdigit(*A) and if the if is 1 it goes back to prompting the level. Of course since '-' is not a digit the check for < 0 is superfluous but I did it anyway. Now prior to prompting the level it zeroes out 'A' (*A='\0'). For the movement the do..while loop condition checks for invalid input but it needed a scanf() with "%2s" also and then use atoi() on the string (A). But in that case there was no need to zero out the string (might not even be in the other but I did it anyway). Now as far as the level goes I checked for > 10 only because later in the code it checks for < 10 and if so it increments it by 2 so I presume that it's invalid if it's >10. This might or might not be correct but I do not know the rules of the game and neither do I know the author's intentions. One more important point is that it does seem to stop playing the game, making the same move again and again, but this might be another problem or maybe it's a draw or something else. As I said I don't know how to play the game so I can't verify it either way.
1987 marked the "The Fourth International Obfuscated C Code Contest"
Look at the README.md file for the given winning entry for information on how to compile it and how to run the winning program. Look at the winning source and try to figure how it does what it does! You may then wish to look at the Author's remarks for even more details.
The rules for 1997 suggested even more categories than in 1986.
Hints for what to do and not to do were also given in the rules.
For example, a simple excessive abuse of /lib/cpp was discouraged unless the
abuse was unusual. The mailboxes for the contest were moved from nsc to amdahl.
The practice of posting a preliminary set of rules for the next year was started
this year.
Rules and results were posted to comp.lang.c and comp.unix.wizards with an announcement in news.announce.important. Micro/Systems Journal published the 1987 winners. Mark R. Horton included a version of the 1987 winners in an appendix of his C book Portable C Software International Edition. The first announcement of winners at the Summer 87 USENIX was helped by a small fly that danced all over the foils.
=-=
Copyright (c) 1987, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is granted provided this this copyright and notice are included in its entirety and remains unaltered. All other uses must receive prior permission in writing from both Landon Curt Noll and Larry Bassel.