/****************************************\
*                                        *
*	        cell.def                 *
*				         *
*      cellular automaton simulator      *
*                                        *
*  	   def: definition file          *
*                                        *
*                                        *
\****************************************/


/*
 *
 * Cellsim copyright 1989, 1990 by Chris Langton and Dave Hiebeler
 * (cgl@lanl.gov, hiebeler@heretic.lanl.gov)
 *
 * This package may be freely distributed, as long as you don't:
* - remove this notice
 * - try to make money by doing so
 * - prevent others from copying it freely
 * - distribute modified versions without clearly documenting your changes
 *   and notifying us
 *
 * Please contact either of the authors listed above if you have questions
 * or feel an exception to any of the above restrictions is in order.
 *
 * If you make changes to the code, or have suggestions for changes,
 * let us know!  If we use your suggestion, you will receive full credit
 * of course.
 */

/*****
 * Cellsim history:
 *
 * Cellsim was originally written on Apollo workstations by Chris Langton.
 *
 * Sun versions:
 *
 * - version 1.0
 *   by C. Ferenbaugh and C. Langton
 *   released 09/02/88
 *
 * - version 1.5
 *   by Dave Hiebeler and C. Langton  May - June 1989
 *   released 07/03/89
 *
 * - version 2.0
 *   by Dave Hiebeler and C. Langton  July - August 1989
 *   never officially released (unofficially released 09/08/89)
 *
 * - version 2.5
 *   by Dave Hiebeler and C. Langton  September '89 - February 1990
 *   released 02/26/90
 *****/



#include <stdio.h>

#define State	unsigned char

#define	BUFLEN	128
#define	ASCZ	'0'
#define UNDEF	(State) '\377'
#define MAXINT 1000000000		/* sufficiently large integer */
#define INTUNDEF -99999		/* for unset integer var defaults */

#define TABLE_ERR	-1


#ifndef TRUE
#define TRUE	01
#endif
#ifndef FALSE
#define FALSE	NULL
#endif

#define NBUFFERS	10
#define BUFOP_XOR	1
#define BUFOP_OR	2
#define BUFOP_AND	3
#define BUFOP_LOAD	4
#define BUFOP_SAVE	5
#define BUFOP_SWAP	6

#define NH_DEFAULT	0
#define NH_VONN		1
#define NH_MOORE	2
#define NH_LIN		3
#define NH_MARG		4

/* to_state converts a character to a numerical state */
#define to_state(c) ((c)<='9' ? (c)-ASCZ : \
			(c)>='a' ? (c)-'a'+10 : (c)-'A'+10)
/* to_char converts a (numerical) state to a character */
#define to_char(n) ((n)==UNDEF ? 'U' :  \
			(n)>9 ? (char) ('A'-10+(n)) : (char) (ASCZ+(n)))

/* Definitions for the various types of drawing-modes */
#define HORIZ_LINE	1
#define HORIZ_END	3
#define VERT_LINE	4
#define VERT_END	6
#define ARB_LINE	7
#define ARB_END		8
#define HOLLOW_CIRC	9
#define HOLLOW_EDGE	10
#define SHADED_CIRC	11
#define SHADED_EDGE	12
#define DRAWING_DONE	13

/* Types of conditions for automatically terminating runs */
#define NEVER 0
#define NO_CHANGE 1
#define ALL_ZERO 2

