Author Topic: Gods C code (oldie but goodie)  (Read 223 times)

Offline StSanta

  • Gold Member
  • *****
  • Posts: 2496
Gods C code (oldie but goodie)
« on: February 20, 2002, 03:27:11 AM »
Here's something fer all the geeks out there. Should be readable for those without any C knowledge as well, although some aspects of it might be lost.

===
/* HUMAN_DNA.H
/*
/* Human Genome
/* Version 2.1
>*
*/

/* Revision history:
 *
 * 0000-00-01 00:00  1.0  Adam.
 * 0000-00-02 10:00  1.1  Eve.
 * 0000-00-03 02:11  1.2  Added noodle code to male   version. A bit messy -- will require a rewrite   later on to make it neater.
 * 0017-03-12 03:14  1.3  Added extra sex drive to    male.h; took code elephant-dna.c
 * 0145-10-03 16:33  1.4  Removed tail.
 * 1115-00-31 17:20  1.5  Shortened forearms,    expanded brain case.
 * 2091-08-20 13:56  1.6  Opposable thumbs added    to hand() routine.
 * 2501-04-09 14:04  1.7  Minor cosmetic         improvements -- skin colour made lighter to   match my own image.
 * 2909-07-12 02:21  1.8  Dentition inadequate;    added extra 'wisdom'teeth.Must remember to make   mouth bigger to compensate.
 * 4501-12-31 14:18  1.9  Increase average height.
 * 5533-02-12 17:09  2.0  Added gay option,        triggered by high population density, to try     and slow the overpopulation problem.
 * 6004-11-04 16:11  2.1  Made forefinger narrower  to fit hole in centre of CD.
 */

/* Standard definitions
*/

#define SEX male
#define HEIGHT 1.84
#define MASS 68
#define RACE caucasian

/* Include inherited traits from parent DNA files.
 * Files must be pre-processed with MENDEL program    to provide proper inheritance features.
*/

#include "mother.h"
#include "father.h"
#infndef FATHER
#warn("Father unknown -- guessing")
#include "bastard.h"
#End If

/* Set up sex-specific functions and variables
*/
#include
/* Kludged code -- I'll re-design this lot and re-write it as a proper library sometime soon.
*/
struct genitals
{
#ifdef MALE
 noodle *jt;
#End If
/* G_spot *g;   Removed for debugging purposes */
#ifdef FEMALE
 Vagina *p;
#End If
}

/* Initialization bootstrap routine -- called   before DNA duplication.
 * Allocates buffers and sets up protein file  pointers
*/
DNA *zygote_initialize(Sperm *, Ovum *);
/* MAIN INITIALIZATION CODE
 *
 * Returns structures containing pre-processed   phenotypes for the organism to display at birth.
 *
 * Will be improved later to make output less  ugly.
*/
Characteristic *lookup_phenotype(Identifier *i);

Offline straffo

  • Persona Non Grata
  • Plutonium Member
  • *******
  • Posts: 10029
Gods C code (oldie but goodie)
« Reply #1 on: February 20, 2002, 03:42:58 AM »
ROTFL :)

I want more !!!!

If you want real nasty C-Code go to : IOCCC

for exemple :

#define _POSIX_SOURCE
#include                                
#include                              
#define                             extern/* ioccc*/
#define                           condition 22+d+e> 31
#define                         declarator main ( void )
#define                       keyword ae(t,d+e-9); ae(m,4)
#define                     false ae (t, d+ e+ 22); ae (m,3)
#define                   syntax_error(n); } else if (J < n) {
#define                 relational_expression(i, o, ccc) i o ccc
#define               errno translation_unit/*Apollo 13*/int errno
#define             iterative_statement  for  (  expressions ) block
#define             translation_unit  declarator  compound_statement
#define             ae(unary_expression,ae)     unary_expression= ae
#define             declaration char T[16];     struct tm ae(s,{ 0})
#define             if_part {macrolist list     ae(b,J%4); type_name
#define             tokens if (t==25&&d==28     &&a > 10) ae (t, 18)
#define             selection_statement(a,b,c) if(a){b; } else{ c; }
#define             storage_class ae(e,(2*b+4*c+6*d+N)%7); statement
#define             statement_list iterative_statement return'^'^'^'
#define            macro(x,y,cast) ae(M,x); ae(N,y)syntax_error(cast)
#define           block { if(relational_expression(J,<,1700))if_part;}
#define          declaration_list int J,a,b,c,d, e,t,m,M,N; declaration
#define         true keyword; selection_statement(t==26,ae(t,19),tokens)
#define        compound_statement { declaration_list ; statement_list ; }
#define       expressions ae(J,1582); relational_expression(J,<,2200); ++J
#define      list macro (24, 5, 2200) ae(M, 24); ae(N, 6); } ae(a, J % 19);
#define     type_name ae (c, J % 7);ae (d, (19 * a + M) % 30); storage_class
#define    statement  selection_statement ( condition,true,false)pptoken cast
#define   macrolist macro(22,2,1800)macro     (23, 3,1900) macro (23, 4, 2100)
#define  pptoken ae(s.tm_year,J-1900);ae       (s.tm_mon,m-1); ae(s.tm_mday,t);
#define cast (void)strftime(T,sizeof T,         "%a %b %d %Y",&s),(void)puts(T);
#include                              
« Last Edit: February 20, 2002, 03:46:44 AM by straffo »