Merge pull request #91 from xexyl/2001-cheong

This commit is contained in:
Landon Curt Noll authored and GitHub committed 2023-03-20 19:39:41 -07:00
commit 1d2d09be9f
2 files changed
+27 -18

No files matched your search

+22 -15
View File
@@ -12,6 +12,13 @@
make
```
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to work with
clang by adding another function that is allowed to have a third arg as an int,
not a `char **`. He chose pain() because it's a four letter word that would
match the format and because it's pain that clang forces this. :-) Thank you
Cody for your assistance!
### To run:
```sh
@@ -56,8 +63,8 @@ This program runs normally on any ANSI C compiler and is ASCII dependent.
Strict compiling gives just one unavoidable warning:
> gcc -ansi -Wall cheong.c
cheong.c:3: warning: third argument of `main' should probably be `char **'
> gcc -ansi -Wall cheong.c
cheong.c:3: warning: third argument of `main' should probably be `char **'
### Obfuscation
@@ -67,23 +74,23 @@ obfuscated in that it only uses subtraction to calculate square roots.
(For a detailed explanation, check Google or see Jack Crenshaw's article
at http://www.embedded.com/98/9802fe2.htm) This program uses an even
more obscured version which includes the following:
- A single string is used to store two numbers of different lengths
- Operations are done in a weird hybrid of base 10 and base 20
- Subtraction is done addition style, i.e. 4 minus 8 equals 6 carry a -1
- Recursive calls to main()
- A single string is used to store two numbers of different lengths
- Operations are done in a weird hybrid of base 10 and base 20
- Subtraction is done addition style, i.e. 4 minus 8 equals 6 carry a -1
- Recursive calls to main()
Minor obfuscations:
- Self documenting whitespace in rectangular code block, for fun and
glory (view with fixed-width font)
- Integer constants adjusted to less meaningful values, just for added
confusion
- Hard-to-read, meaningless variable names to spite the reader
- Self documenting whitespace in rectangular code block, for fun and glory (view
with fixed-width font)
- Integer constants adjusted to less meaningful values, just for added confusion
- Hard-to-read, meaningless variable names to spite the reader
Challenges for the masses:
- What are the meanings [sic, plural] of the variable o?
- Why is (c+999)%10-(D[I]+92)%10 not equivalent to (c-D[I]+7)%10?
- How does the program terminate?
- Is the programmer sane? ;-)
- What are the meanings [sic, plural] of the variable o?
- Why is (c+999)%10-(D[I]+92)%10 not equivalent to (c-D[I]+7)%10?
- How does the program terminate?
- Is the programmer sane? ;-)
### Appreciation
+5 -3
View File
@@ -1,12 +1,14 @@
#include <stdio.h>
int l;int main(int o,char **O,
int l;int pain(int o,char **O,
int I){char c,*D=O[1];if(o>0){
for(l=0;D[l ];D[l
++]-=10){D [l++]-=120;D[l]-=
110;while (!main(0,O,l))D[l]
110;while (!pain(0,O,l))D[l]
+= 20; putchar((D[l]+1032)
/20 ) ;}putchar(10);}else{
c=o+ (D[I]+82)%10-(I>l/2)*
(D[I-l+I]+72)/10-9;D[I]+=I<0?0
:!(o=main(c/10,O,I-1))*((c+999
:!(o=pain(c/10,O,I-1))*((c+999
)%10-(D[I]+92)%10);}return o;}
int main(int o,char **O) {
return pain(o, O, l); }