Thank you, @chris-sab, for your excellent work and for helping us commit this alpha version of the topbar. As part of this work, the following HTML sections were removed: * begin-row * begin-leftcolumn * sidenav * end-leftcolumn * begin-rightcolumn * before-content * end-rightcolumn * end-row.default Also added a new HTML section, just above the "header" section: * topbar The web site now as a more modern looking topbar, thanks to the work of the contractor (GitHub user @chris-sab) who is working on issue #2273. Performed `make www` to implement the above and test under macOS. TODO: Fix the Responsive Web Design to deal with the new topbar system. TODO: Improve the topbar. What is there now is just an alpha version. TODO: Decide what to do with `png/ioccc.png`. Remove it make selective use of the image on certain top level pages lower down? TODO: The changes to `ioccc.css` causes some formatting problems with pages such as `location.html` (missing blank lines). Fix formatting problems as needed. TODO: Fix the "Nu HTML check this web page" links on things like the year level _YYYY/index.html_ pages. TODO: Correct all HTML errors, warnings and perhaps informative messages from the Nu HTML check. TODO: Consider adding color (colour) to the web pages in such a way that people with color perception challenges can still use the web site. TODO: For those web browsers that have and allow JavaScript, make use of technology such as [Code Mirror](https://codemirror.net/) to directly render source code (C, shell, Makefile, etc.) with syntax coloring (colouring) directly in the browser. For non-JavaScript browsers, fallback to the current use of GitHub source code viewing.
To build:
make
To use:
./cheong digits
Try:
./try.sh
Judges' remarks:
Be sure to give an even number of digits in the argument. Add a leading 0 if needed.
The source code is nice, compact, and self documenting as all good programs should be! :-)
Author's remarks:
Operation
Compile normally and run with one argument, an integer with 2n digits. Program will return the integer part of its square root (n-digits). For example,
$ cc -o cheong cheong.c
$ ./cheong 1234567890
35136
$ ./cheong 0200000000000000000000000000
14142135623730
Deviation from these instructions will cause undefined results. :-)
Portability
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 **'
Obfuscation
The main obfuscation is the algorithm used to calculate square roots, sometimes known as the longhand method. The basic algorithm is itself obfuscated in that it only uses subtraction to calculate square roots. For a detailed explanation, check Google or see Jack Crenshaw's article at https://web.archive.org/web/20011215124349/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 - 8equals6carry 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
Challenges for the masses:
- What are the meanings [sic, plural] of the variable
o? - Why is
(c+999)%10-(D[I]+92)%10not equivalent to(c-D[I]+7)%10? - How does the program terminate?
- Is the programmer sane? ;-)
Appreciation
Thanks goes out to Bobby Rohde for numerous suggestions on how to shorten the program.