Minor fixes to 1996/schweikh1

The author noted in the Makefile that for Solaris the compiler flag
-I/usr/include should be included so I have added that.

As well I updated the README.md - formatting fixes (possibly typos as
well but no longer sure).
This commit is contained in:
Cody Boone Ferguson committed 2023-03-20 08:58:13 -07:00
1 parent 4614d2a4bb
commit 2d6d05e053
2 files changed
+22 -11

No files matched your search

+1 -1
View File
@@ -98,7 +98,7 @@ CDEFINE=
# Include files that are needed to compile # Include files that are needed to compile
# #
#CINCLUDE= #CINCLUDE=
CINCLUDE= -I. CINCLUDE= -I. -I/usr/include
#CINCLUDE= -include stdlib.h #CINCLUDE= -include stdlib.h
#CINCLUDE= -include stdio.h #CINCLUDE= -include stdio.h
#CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h
+21 -10
View File
@@ -12,11 +12,11 @@
make all make all
### To run ## To run:
./schweikh1 ./schweikh1
## Judges' comments ## Judges' comments:
Look at the source. There is something very odd going on here. Look at the source. There is something very odd going on here.
Where does the real code come from if everything is a C pre-processor Where does the real code come from if everything is a C pre-processor
@@ -25,7 +25,7 @@
Clearly this is either the Best Use or the Worst Abuse of the Clearly this is either the Best Use or the Worst Abuse of the
C Preprocessor that the judges have seen this year! C Preprocessor that the judges have seen this year!
## Author's comments ## Author's comments:
What this program does What this program does
---------------------- ----------------------
@@ -50,19 +50,26 @@
Let c be the modulus of J divided by 7 Let c be the modulus of J divided by 7
Let d be the modulus of (19a + M) divided by 30 Let d be the modulus of (19a + M) divided by 30
Let e be the modulus of (2b + 4c + 6d + N) divided by 7 Let e be the modulus of (2b + 4c + 6d + N) divided by 7
The interesting Sunday is either
The interesting Sunday is either:
March 22 + d + e or March 22 + d + e or
April d + e - 9 (only one of them is a valid date) April d + e - 9 (only one of them is a valid date)
with the following exceptions: with the following exceptions:
April 26 must always be changed to April 19 April 26 must always be changed to April 19
April 25 must be changed to April 18 if d is 28 and a greater than 10 April 25 must be changed to April 18 if d is 28 and a greater than 10
Example: J = 1962, M = 24, N = 5 ### Example:
J = 1962, M = 24, N = 5
a = J % 19 = 5 a = J % 19 = 5
b = J % 4 = 2 b = J % 4 = 2
c = J % 7 = 2 c = J % 7 = 2
d = 119 % 30 = 29 d = 119 % 30 = 29
e = 191 % 7 = 2 e = 191 % 7 = 2
March 53 is invalid, so the result is April 22 1962 March 53 is invalid, so the result is April 22 1962
Why I think this is obfuscated Why I think this is obfuscated
@@ -87,20 +94,24 @@
these easy to remember language elements is justified in my opinion. these easy to remember language elements is justified in my opinion.
The moral: ### The moral:
Try to be as precise as can be and no one will comprehend what you mean. Try to be as precise as can be and no one will comprehend what you mean.
The formula: #### The formula:
comprehension = 1/(2**precision) comprehension = 1/(2**precision)
The interpretation: #### The interpretation:
"Say nothing and everybody will understand." "Say nothing and everybody will understand."
The -I/usr/include in the build file is needed by gcc on Solaris because The `-I/usr/include` in the build file is needed by gcc on Solaris because
gcc's "fixed" header in gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h gcc's "fixed" header in gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h
is broken (sort of) because it has *two* identical extern is broken (sort of) because it has *two* identical extern
declarations of errno. This leads to an error due to the declarations of errno. This leads to an error due to the
redefinition of main. The -I option makes sure the working redefinition of main. The `-I` option makes sure the working
/usr/include/errno.h is found first, which shouldn't harm on other /usr/include/errno.h is found first, which shouldn't harm on other
systems. systems.