Code

NODElib

The Neural Optimization Development Engine library

Quick Links

From the Main Page

NODElib (which stands for Neural Optimization Development Engine library) is a programming library for rapidly developing powerful neural network simulations. Very few assumptions have been made regarding the system in which the code is to be used; thus, NODElib is suitable as a back-end engine for most applications.

But wait, there's more.

NODElib is general enough that you can probably find many other uses for it. The code is extremely modular, compact, and robust. It is written in an object oriented manner. All of the library code, example and test program source, documentation, and supporting text is only on the order of about 20,000 lines, which means that NODElib is extremely compact. This is important from the point of view of comprehending the code, and for the memory requirements of the library.

Status Update

I haven't done a serious update to NODElib in a long time. Nonetheless, a fair number of people are still using it, which makes me happy to no end. I hope to resume maintaining NODElib in the very near future (mid 2005), with the hope that I can give it the attention that it deserves. However, if you would like to take a crack at maintaining it, get me a shout.

CBofN Code

Source Code from The Computational Beauty of Nature

Quick Links

From the Main Page

The source code is currently available many flavors:

  • cbn-noarch-src.tgz - only the source code. You will need either (1) GNU make and gcc, or (2) Microsoft Visual C++, in order to build the source. Moreover, perl and sed are required to build the manual and HTML pages. Get this only if you are hacker that wants to get down and dirty with everything (216 KB).
  • cbn-noarch-src+docs.tgz - same as above but has the manual and HTML pages prebuilt. Get this only if you are hacker but you don't want to build the docs (259 KB).
  • cbn-noarch-src+docs.zip - same as above but as a zip archive. Get this only if you are Windows hacker (462 KB).
  • cbn-linux-bin.tgz - contains everything prebuilt for an i386 linux box with glibc and glibm (498 KB).
  • cbn-sunos-bin.tgz - this contains everything prebuilt for Sun machines running SunOS. (1,177 KB).
  • cbn-win-bin.zip - this contains everything prebuilt for Windows 95/98/NT (1,807 KB).
  • cbn-mac-bin.sit.hqx - this contains only the Mac executables. You may also want to get cbn-noarch-src+docs.zip for documentation and source, as well as cbn-mac-proj.sit.hqx for an example project file under CodeWarrior. (1,557 KB).

Status Update

It's been a long time since I updated this as well. I intend to make sure that it cleanly compiles on all major platforms in the very near future. (Look specifically for Windows, OS X, and Linux to be all supported.)

IOCCC

A couple of years ago I submitted an entry to the International Obfuscated C Coding Competition. I didn't even rate. Nonetheless, this is one of my all time favorite little hacks.

Quick Links

From the IOCCC submission

This program prints out the first 2^N prime numbers, where N is equal to the number of supplied command-line arguments, argc.

Regarding the format, excepting the #define lines, the source has no spaces and has the property that any white space characters can be inserted anywhere without breaking the code. I took the liberty of making the 15 source lines have length equal to the first 15 primes. Clever planning on my part? Nope, just a happy coincidence.

Why is this obfuscated? Go ahead, do a 'gcc -E prog.c | indent'. The code does not use a single if/then, while loop, or for loop. This baby is pure recursion, and nothing else. The code does use a handful of + and - operations, but each use always has at least one constant 1 as an argument (thus, no real higher math). Also note that the only constants in the code are 0, 1, and 2. Moreover, there are no local or global variables, only function parameters.

Status Update

I unobfuscated and documented to the code for fun, and made it the basis for one of my Brain Candy columns. What follows is from the documentation:

This program demonstrates the most ridiculous method for computing primes. It uses only unsigned recursive functions, increment (++), decrement (--), if, return, and 0. Also, a single printf() is used for output, but that's it.

The interesting thing is that this subset of C is Turing complete. So whatever can be done on a general purpose computer can also be done in this primitive C. In fact, it wouldn't be too difficult to show that this subset of C is trivially identical to the general recursive functions; but that's left as an exercise for the reader ;-).

3 Responses to “Code”

2007 Apr 11
7:00 pm

alex wrote:

hi nice site.

2007 May 9
11:41 am

GWF wrote:

Thank you. (But to be honest, I think you are a spam bot).

2007 Jun 14
1:14 pm

robert wrote:

hi all.

Leave a reply