Files
ioccc/1990/baruch
Landon Curt Noll dbf6921b3a use include 1337.mk to hold 1337 hacker rulz
Updated 1337 hacker rulz to version 7.

Added `1337.mk` to contain the updated 1337 hacker rulz (v7).

We use an optional include of `1337.mk` (or `../1337.mk`,
or `../../1337.mk`) to include the 1337 hacker rulz.

Changed `make deep_magic` to `make more_magic`.

Changed `bin/tar-entry.sh` VERSION from "1.3.7 2024-07-22"
to "1.3.8 2024-07-23".

Changed `bin/tar-year.sh` VERSION from "1.2.5 2024-07-22"
to "1.2.6 2024-07-23".

Add `make new_entry` to `YYYY/Makefile` and `template/Makefile.year`.

Change `make new_year` to use `sort -n -u`.

Made minor debug message fixes to `bin/new-year.sh`.

Changed `bin/new-year.sh` VERSION from "1.3 2024-07-23"
to "1.3.1 2024-07-23".

Improved `bin/add-dir.sh` to update `YYYY/Makefile` with
the new entry directory name.

Changed `bin/add-dir.sh` VERSION from "1.0 2024-07-21"
to "1.1 2024-07-23".

Performed `make www` to accomplish the above and to test under macOS.
2024-07-23 22:45:16 -07:00
..
2024-06-14 06:52:23 -07:00
2023-07-06 21:49:38 -07:00

To build:

    make all

There is an alternate version for those using Turbo-C or MSC. See alternate code below for details.

Bugs and (Mis)features:

The current status of this entry is:

STATUS: INABIAF - please DO NOT fix

For more detailed information see 1990/baruch in bugs.html.

To use:

    echo 4 | ./baruch
    echo 7 | ./baruch

Try:

    ./try.sh

Alternate code:

This alternate code is for the very few users here who will need it. Nonetheless if you're using Turbo-C or MSC, the code is available, based on the authors' remarks except that the " #Q" string was not changed as that showed worse looking output instead of improved output though admittedly we have no way to test the compilers in question. YMMV.

Alternate build:

    make alt

Alternate use:

Use baruch.alt as you would baruch.

Judges' remarks:

This program reads an integer between 4 and 99 from the stdin.

NOTE: The original program did not have a newline at the end of the file. We added a final newline to the file to make unpacking easy.

Authors' remarks:

The goal of this work was to write a program that solves the classic n-queens problem, with a board size of up to 99x99, while keeping the program as short as possible.

The program finds all possibilities to place N chess queens on an NxN chessboard so that no queen is in range of any other queen (not in the same column row or diagonal). For each solution the chess board and the place of the queens is printed to stdout.

This program is about as simple and as readable as possible. To make things even more simple we used a very limited subset of C:

  • No pre-processor statements
  • Only one, harmless, for statement
  • No ifs
  • No breaks
  • No cases
  • No functions outside the standard C library
  • No gotos
  • No structures

In short, it contains no C language that might confuse the innocent reader. :-)

This program demonstrates the claim that in C, any program can be written using a single 'for' statement, as long as it is long enough.

For PC users:

In order to compile the program under Turbo-C or MSC, int should be inserted at the beginning of the program. For better looking results it is recommended to replace the " #Q" string with " \261\2".