CellEngine/src/cellengine.cpp File Reference

#include "stdafx.h"

Go to the source code of this file.

Classes

struct  StateInfo

Defines

#define RANDOMS_COUNT   256
#define MOORE_A
#define MOORE_AB
#define VON_NEUMANN
#define MARGOLIS_ODD
#define MARGOLIS_EVEN
#define MARGOLIS_ODD_PH
#define MARGOLIS_EVEN_PH
#define MARGOLIS_ODD_HV
#define MARGOLIS_EVEN_HV
#define LIFE
#define BRAIN
#define HEAT
#define DHEAT
#define LHEAT   (Byte)((n + w + e + s + frob) >> 2)
#define LDHEAT   (Byte)((last = (n + w + e + s + frob + (last & 3))), (last >> 2))
#define ABDHEAT
#define ABCDHEAT
#define RANCH(nw, n, ne, w, c, e, sw, s, se)   (Byte)(n ^ w ^ e ^ s)
#define XRANCH   (n ^ s ^ e ^ w)
#define ANNEAL
#define ANNEAL4
#define ANNEAL8
#define ANTILIFE
#define ECO
#define TORBEN
#define TORBEN2
#define TORBEN3   ((TORBEN) ^ (TORBEN2))
#define TORBEN4
#define FDHEAT(nw, n, ne, w, c, e, sw, s, se)
#define FABCDHEAT(nw, n, ne, w, c, e, sw, s, se)
#define SUM8R(m, nw, n, ne, w, c, e, sw, s, se)   (((nw&m) + (n&m) + (ne&m) + (w&m) + (e&m) + (sw&m) + (s&m) + (se&m)))
#define SUM9R(m, nw, n, ne, w, c, e, sw, s, se)   (((nw&m) + (n&m) + (ne&m) + (w&m) + (c&m) + (e&m) + (sw&m) + (s&m) + (se&m)))
#define RISCA(nw, n, ne, w, c, e, sw, s, se)
#define INSERT   (Byte)((c & mask) | val)
#define HEACO
#define MARBLE(nw, n, ne, w, c, e, sw, s, se)
#define SMARBLE(nw, n, ne, w, c, e, sw, s, se)   result = ((c << 3) + nw + n + ne + w + frob + e + sw + s + se) >> 4;
#define FARBLE(nw, n, ne, w, c, e, sw, s, se)
#define GARBLEBUG(nw, n, ne, w, c, e, sw, s, se)
#define GARBLE(nw, n, ne, w, c, e, sw, s, se)
#define TWOHEATS(nw, n, ne, w, c, e, sw, s, se)
#define PART_MASK   0xe0
#define ABCD_MASK   0x60
#define PART(x)   ((x) & PART_MASK)
#define ABCD(x)   (((x) & ABCD_MASK) | 0x80)
#define PART_EMPTY   0x00
#define PART_PLASMA   0x20
#define PART_WALL   0x40
#define PART_MIRROR   0x60
#define PART_A   0x80
#define PART_B   0xa0
#define PART_C   0xc0
#define PART_D   0xe0
#define ISPLASMA(x)   (PART(x) == PART_PLASMA)
#define ISWALL(x)   (PART(x) == PART_WALL)
#define ISMIRROR(x)   (PART(x) == PART_MIRROR)
#define ISA(x)   (PART(x) == PART_A)
#define ISB(x)   (PART(x) == PART_B)
#define ISC(x)   (PART(x) == PART_C)
#define ISD(x)   (PART(x) == PART_D)
#define ISABCD(x)   ((x) & 0x80)
#define ISEMPTY(x)   (PART(x) == PART_EMPTY)
#define PAYLOAD_MASK   0x1c
#define PAYLOAD(x)   ((x) & PAYLOAD_MASK)
#define DIR_MASK   0x03
#define DIR(x)   ((x) & DIR_MASK)
#define DIR_N   0x00
#define DIR_E   0x01
#define DIR_S   0x02
#define DIR_W   0x03
#define NOTPART_MASK   (PAYLOAD_MASK | DIR_MASK)
#define NOTPART(x)   ((x) & NOTPART_MASK)
#define OPCODE_MASK   0xf0
#define OPCODE(x)   ((x) & OPCODE_MASK)
#define OPCODE_NORTH   0x00
#define OPCODE_EAST   0x10
#define OPCODE_SOUTH   0x20
#define OPCODE_WEST   0x30
#define OPCODE_NORTHMIRROR   0x40
#define OPCODE_EASTMIRROR   0x50
#define OPCODE_SOUTHMIRROR   0x60
#define OPCODE_WESTMIRROR   0x70
#define OPCODE_SPACE   0x80
#define OPCODE_MAGIC   0x90
#define OPCODE_METAL   0xa0
#define OPCODE_MICROPHONE   0xb0
#define OPCODE_SPEAKER   0xc0
#define OPCODE_INPUT   0xd0
#define OPCODE_OUTPUT   0xe0
#define OPCODE_RANDOM   0xf0
#define FLOW_MASK   0x70
#define FLOW(x)   ((x) & FLOW_MASK)
#define FLOW_N   0x00
#define FLOW_E   0x10
#define FLOW_S   0x20
#define FLOW_W   0x30
#define IS_FLOWING(x)   ((x) < OPCODE_MAGIC)
#define OPERAND_MASK   0x0f
#define OPERAND(x)   ((x) & OPERAND_MASK)
#define SPINSONLY
#define SPINSBANK
#define SPINSHEAT
#define SPINGLASS
#define MARG
#define GLASSBONDS
#define GLASSHEAT
#define FADERS
#define HARBLE(nw, n, ne, w, c, e, sw, s, se)
#define random1(i)   ((i * i) & 65535)
#define random2(i)   (((i * i) & 65535) >> 2)
#define VANNEAL
#define VANNEAL8

Enumerations

enum  {
  U = 0x00, S = 0x01, S0 = 0x02, S1 = 0x03,
  S00 = 0x04, S01 = 0x05, S10 = 0x06, S11 = 0x07,
  S000 = 0x08, C00 = 0x10, C10 = 0x11, C01 = 0x90,
  C11 = 0x91, OR = 0x20, OU = 0x21, OL = 0x22,
  OD = 0x23, SR = 0x40, SU = 0x41, SL = 0x42,
  SD = 0x43, ORX = 0xa0, OUX = 0xa1, OLX = 0xa2,
  ODX = 0xa3, SRX = 0xc0, SUX = 0xc1, SLX = 0xc2,
  SDX = 0xc3, DM = 0x03, RD = 0x00, UD = 0x01,
  LD = 0x02, DD = 0x03, EX = 0x80, NX = 0x7f
}

Functions

void PrimeRandoms ()
void FeedRandom (long food)
long Rand32 ()
long Rand16 ()
long Rand8 ()
Byte RandDir (Byte x)
static void C_Noise (long u_init, long v_init, long du, long dv, long ddu, long ddv, unsigned char *screen_buffer, unsigned int count)
unsigned char MARG_RULE_DIFFUSION (unsigned char c, unsigned char cw, unsigned char ccw, unsigned char opp, unsigned char r, unsigned char p)
unsigned char MARG_RULE_GAS (unsigned char c, unsigned char cw, unsigned char ccw, unsigned char opp, unsigned char r, unsigned char p)
int sp (Byte right, Byte up, Byte left, Byte down)
int op (Byte right, Byte up, Byte left, Byte down)
int osp (Byte right, Byte up, Byte left, Byte down)
int wop (Byte state, Byte right, Byte up, Byte left, Byte down)
int wsp (Byte state, Byte right, Byte up, Byte left, Byte down)
int wce (Byte state, Byte right, Byte up, Byte left, Byte down)
Byte cascade (Byte right, Byte up, Byte left, Byte down)
Byte excite (Byte state)
Byte decay (Byte state)

Variables

const char * ruleTables []
static int ruleCount = -1
static long randomsPrimed = 0
static long randoms [RANDOMS_COUNT]
static long randomRead = 0
static long randomWrite = 0
static Byte GlassBondsTable [16]
static Byte GlassHeatTable [16]
const int JVNSTATES = 29
StateInfo states [JVNSTATES]
static bool jvnInitialized = false
const char * codeToName [256]


Detailed Description

Cellular Automata Machine Engine
Author:
Don Hopkins

Definition in file cellengine.cpp.


Define Documentation

#define ABCDHEAT

Value:

(Byte)((last = (n + w + e + s + \
                    (((xx^yy^phase)&1) ? frob : -frob) + \
                    (last & 3)), \
            (last >> 2)))

#define ABDHEAT

Value:

(Byte)(((n + w + e + s + \
             (((xx^yy^phase)&1) ? frob : -frob)) >> 2))

#define ANNEAL

Value:

( \
    (((sum = SUM9REG(1)) > 5) || (sum == 4)) | \
    ((c&0x7f) << 1))

#define ANNEAL4

Value:

( \
    ((((sum0 = (SUM9REG(1) >> 0)) > 5) || (sum0 == 4)) ? 1 : 0) | \
    ((((sum1 = (SUM9REG(2) >> 1)) > 5) || (sum1 == 4)) ? 2 : 0) | \
    ((((sum2 = (SUM9REG(4) >> 2)) > 5) || (sum2 == 4)) ? 4 : 0) | \
    ((((sum3 = (SUM9REG(8) >> 3)) > 5) || (sum3 == 4)) ? 8 : 0) | \
    ((c & 0x0f) << 4))

#define ANNEAL8

Value:

( \
    ((((sum0 = (SUM9REG(1) >> 0)) > 5) || (sum0 == 4)) ? 1 : 0) | \
    ((((sum1 = (SUM9REG(2) >> 1)) > 5) || (sum1 == 4)) ? 2 : 0) | \
    ((((sum2 = (SUM9REG(4) >> 2)) > 5) || (sum2 == 4)) ? 4 : 0) | \
    ((((sum3 = (SUM9REG(8) >> 3)) > 5) || (sum3 == 4)) ? 8 : 0) | \
    ((((sum4 = (SUM9REG(16) >> 4)) > 5) || (sum4 == 4)) ? 16 : 0) | \
    ((((sum5 = (SUM9REG(32) >> 5)) > 5) || (sum5 == 4)) ? 32 : 0) | \
    ((((sum6 = (SUM9REG(64) >> 6)) > 5) || (sum6 == 4)) ? 64 : 0) | \
    ((((sum7 = (SUM9REG(128) >> 7)) > 5) || (sum7 == 4)) ? 128 : 0))

#define ANTILIFE

Value:

( \
     ((sum = SUM8REG(1)), \
     (((c&1) ? (sum != 5) : (((sum != 5) && (sum != 6)) ? 1 : 0)) | \
       ((c&0x7f) << 1))))

#define BRAIN

Value:

( \
    (((c & 0x03) == 0) \
        ? ((SUM8REG(1) == 2) ? 1 : 0) \
        : 0) | \
    ((c << 1) & 0xfe))

#define DHEAT

Value:

last += (nw + n + ne + w + frob + e + sw + s + se); \
    *front = (Byte)last >> 3; \
    last &= 7;

#define ECO

Value:

( \
      ((((sum = (SUM9REG(128) >> 7)) > 5) || (sum == 4)) \
        ? ((ANTILIFE & 127) | 128) \
        : (BRAIN & 127)))

#define FABCDHEAT ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

error += (n + s + w + e + frobby); \
    result = error >> 2; \
    error &= 3; \
    frobby = -frobby;

Definition at line 2786 of file cellengine.cpp.

#define FADERS

Value:

( \
    (sum = SUM8REG(1)), \
    ( ((c == 0) && (sum == 2)) \
        ? (state = 1) \
        : (state = 0)), \
    ( (c == 1) \
        ? ((sum == 2) \
            ? (state = 1) \
            : (state = 2)) \
        : 0), \
    ( (((c & 1) == 0) && \
       (0 < c) && \
       (c < (unsigned char)(frob & 0xff))) \
        ? (state = c + 2) \
        : 0), \
    (unsigned char)state)

#define FARBLE ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

error += ((c << 3) + sw + se + w + frob + e + sw + s + s + se); \
    result = error >> 4; \
    error &= 0x0f;

Definition at line 3252 of file cellengine.cpp.

#define FDHEAT ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

error += (nw + n + ne + w + frob + e + sw + s + se); \
    result = error >> 3; \
    error &= 7;

Definition at line 2184 of file cellengine.cpp.

#define GARBLE ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

switch (((yy + xx + c) >> 2) & 3) { \
    case 0: \
        error += (frob + (c << 3) + w + sw + sw + s + s + se + se + e); \
        break; \
    case 1: \
        error += (frob + (c << 3) + w + w + w + sw + sw + s + se + e); \
        break; \
    case 2: \
        error += (frob + (c << 3) + w + w + sw + sw + se + se + e + e); \
        break; \
    case 3: \
        error += (frob + (c << 3) + w + sw + s + se + se + e + e + e); \
        break; \
    } \
    result = error >> 4; \
    error &= 0x0f;

Definition at line 3445 of file cellengine.cpp.

#define GARBLEBUG ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

switch (((y + x + c) >> 2) & 3) { \
    case 0: \
        error += (frob + (c << 3) + w + sw + sw + s + s + se + se + e); \
        break; \
    case 1: \
        error += (frob + (c << 3) + w + w + w + sw + sw + s + se + e); \
        break; \
    case 2: \
        error += (frob + (c << 3) + w + w + sw + sw + se + se + e + e); \
        break; \
    case 3: \
        error += (frob + (c << 3) + w + sw + s + se + se + e + e + e); \
        break; \
    } \
    result = error >> 4; \
    error &= 0x0f;

Definition at line 3356 of file cellengine.cpp.

#define GLASSBONDS

Value:

( \
    ((c  /* >> 1*/ ) & 0x7f) | \
    ((GlassBondsTable[MARG] & 1) << 7) \
)

#define GLASSHEAT

Value:

( \
    (code = GlassHeatTable[MARG]), \
    (error += SUM8REG(0x7f) + frob), \
    (error = ((error < 0) \
        ? 0 \
        : ((error > (0x7f << 3)) \
            ? (0x7f << 3) \
            : error))), \
    ((code == 2) \
        ? (((error >= low) && \
            (error >= inflation)) /* can we get from bank? */ \
            ? (error -= inflation, code ^= 1) /* flip and debit */  \
            : 0 \
          ) \
        : ((code == 3) \
            ? (((error <= high) && \
                (error < (0x80 << 3) - inflation)) /* can we put to bank? */ \
                ? (error += inflation, code ^= 1) /* flip and credit */ \
                : 0 \
              ) \
            : 0 \
          ) \
    ), \
    (code = ((code << 7) & 0x80) | \
            ((error >> 3) & 0x7f)), \
    (error &= 0x07), \
    code \
)

#define HARBLE ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

switch ((((xx - yy) >> 3) + (((xx - yy * 2 - 1) ^ (xx * 2 + yy + 1)) >> 2) + ((c + (hubba >> 4)) >> 2)) & 7) { \
    case 0: \
        error += (frob + (c << 3) + w + sw + s + s + s + s + se + e); \
        break; \
    case 1: \
        error += (frob + (c << 3) + nw + w + sw + sw + sw + sw + s + se); \
        break; \
    case 2: \
        error += (frob + (c << 3) + n + nw + w + w + w + w + sw + s); \
        break; \
    case 3: \
        error += (frob + (c << 3) + ne + n + nw + nw + nw + nw + w + sw); \
        break; \
    case 4: \
        error += (frob + (c << 3) + e + ne + n + n + n + n + nw + w); \
        break; \
    case 5: \
        error += (frob + (c << 3) + se + e + ne + ne + ne + ne + n + nw); \
        break; \
    case 6: \
        error += (frob + (c << 3) + s + se + e + e + e + e + ne + n); \
        break; \
    case 7: \
        error += (frob + (c << 3) + sw + s + se + se + se + se + e + ne); \
        break; \
    } \
    result = error >> 4; \
    error &= 0x0f;

Definition at line 4547 of file cellengine.cpp.

#define HEACO

Value:

(Byte)( \
        (sum = nw + n + ne + w + e + sw + s + se + frob + last), \
        (last = sum & 31), \
        (sum = (sum >> 3) & (~3)), \
        (sum | ((c&1) << 1) | \
         (((c&3) == 0) && \
          (SUM8REG(1) == 2))))

#define HEAT

Value:

( \
    (nw + n + ne + w + frob + e + sw + s + se) >> 3)

#define LIFE

Value:

( \
     ((c & 1) \
        ? (((sum = SUM8REG(1)) == 2) || \
           (sum == 3)) \
        : ((SUM8REG(1) == 3) ? 1 : 0)) | \
     ((c & 0x7f) << 1))

#define MARBLE ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

error += ((c << 3) + nw + n + ne + w + frob + e + sw + s + se); \
    result = error >> 4; \
    error &= 0x0f;

Definition at line 3089 of file cellengine.cpp.

#define MARGOLIS_EVEN

Value:

( \
    /* c c' */ \
    (c & 3) | \
    /* cw cw' */ \
    (i = ((xx & 1) ? ((yy & 1) ? (w & 3) : (s & 3)) \
                   : ((yy & 1) ? (n & 3) : (e & 3))), \
     (((i & 1) << 2) | ((i & 2) << 4))) | \
    /* ccw ccw' */ \
    (i = ((xx & 1) ? ((yy & 1) ? (n & 3) : (w & 3)) \
                   : ((yy & 1) ? (e & 3) : (s & 3))), \
     (((i & 1) << 3) | ((i & 2) << 5))) | \
    /* opp opp' */ \
    (i = ((xx & 1) ? ((yy & 1) ? (nw & 3) : (sw & 3)) \
                   : ((yy & 1) ? (ne & 3) : (se & 3))), \
     (((i & 1) << 4) | ((i & 2) << 6))))

#define MARGOLIS_EVEN_HV

Value:

( \
    MARGOLIS_EVEN | \
    ((xx & 1) << 8) | \
    ((yy & 1) << 9))

#define MARGOLIS_EVEN_PH

Value:

( \
    MARGOLIS_EVEN | \
    0x200)

#define MARGOLIS_ODD

Value:

( \
    /* c c' */ \
    (c & 3) | \
    /* cw cw' */ \
    (i = ((xx & 1) ? ((yy & 1) ? (e & 3) : (n & 3)) \
                   : ((yy & 1) ? (s & 3) : (w & 3))), \
     (((i & 1) << 2) | ((i & 2) << 4))) | \
    /* ccw ccw' */ \
    (i = ((xx & 1) ? ((yy & 1) ? (s & 3) : (e & 3)) \
                   : ((yy & 1) ? (w & 3) : (n & 3))), \
     (((i & 1) << 3) | ((i & 2) << 5))) | \
    /* opp opp' */ \
    (i = ((xx & 1) ? ((yy & 1) ? (se & 3) : (ne & 3)) \
                   : ((yy & 1) ? (sw & 3) : (nw & 3))), \
     (((i & 1) << 4) | ((i & 2) << 6))))

#define MARGOLIS_ODD_HV

Value:

( \
    MARGOLIS_ODD | \
    ((xx & 1) << 8) | \
    ((yy & 1) << 9))

#define MARGOLIS_ODD_PH

Value:

( \
    MARGOLIS_ODD | \
    0x100)

#define MOORE_A

Value:

( \
     ((nw & 1) << 5) |  \
     ((n  & 1) << 9) | \
     ((ne & 1) << 4) | \
     ((w  & 1) << 7) | \
     ((c  & 3) << 0) | \
     ((e  & 1) << 6) | \
     ((sw & 1) << 3) | \
     ((s  & 1) << 8) | \
     ((se & 1) << 2))

#define MOORE_AB

Value:

( \
    MOORE_A | \
    ((c & 0x0c) << 8))

#define SPINGLASS

Value:

( \
    ((((xx + x) ^ (yy + y) ^ phase) & 1) /* spatio-temporal phase */ \
        ? c /* stay the same if true */ \
        : (((((((n >> 7) ^ (c >> 0)) & 1) + \
              (((w >> 7) ^ (c >> 1)) & 1) + \
              (((s >> 7) ^ (s >> 0)) & 1) + \
              (((e >> 7) ^ (e >> 1)) & 1)) != 2) \
            ? (c & 1) /* stay the same if energy != 2 */ \
            : ((c & 1) ^ 0x80) /* flip if energy == 2 */ \
           ) \
          ) \
    ) \
)

#define SPINSBANK

Value:

( \
    ((((xx + x) ^ (yy + y) ^ phase) & 1) /* spatio-temporal phase */ \
        ? c /* stay the same if true */ \
        : (((c & 3) ^ /* else xor center with the following */ \
            ((bonds = SUM4REG(1)), \
             (bonds = ((c & 1) /* if center then subtract from 4 */ \
                ? (4 - bonds) \
                : (bonds))), \
             (((bonds == 0) || /* case 0, 4 */ \
               (bonds == 4)) \
                ? 0 /* xor with 0 */ \
                : ((bonds == 2) /* case 2 */ \
                    ? 1 /* xor with 1 */ \
                    : ((bonds == 1) /* case 1 */ \
                        ? ((c & 2) /* can we get from bank? */ \
                            ? 0 /* xor with 0 */ \
                            : 3 /* xor with 3 */ \
                          ) \
                        : ((c & 2) /* can we put to bank? */ \
                            ? 3 /* xor with 3 */ \
                            : 0 /* xor with 0 */ \
                          ) \
                      ) \
                  ) \
             ) \
            ) \
           ) \
          ) \
    ) \
)

#define SPINSONLY

Value:

( \
    ((((xx + x) ^ (yy + y) ^ phase) & 1) /* spatio-temporal phase */ \
        ? c /* stay the same if true */ \
        : (((SUM4REG(1) != 2) /* can we not flip? */ \
                ? (c & 1) /* no flip */ \
                : ((c ^ 1) & 1) /* do flip */ \
           ) \
          ) \
    ) \
)

#define TORBEN

Value:

( \
    ((((sum1 = SUM9REG(1)) > 6) || (sum1 == 5) || (sum1 == 3)) ? 1 : 0) | \
    ((c & 0x7f) << 1))

#define TORBEN2

Value:

( \
    ((((sum2 = SUM9REG(1)) > 6) || (sum2 == 3) || (sum2 == 4)) ? 1 : 0) | \
    ((c & 0x7f) << 1))

#define TORBEN4

Value:

( \
    ((((sum = SUM9REG(1)) == 0) || \
                  (sum == 4) || \
                  (sum == 6) || \
                  (sum == 7) || \
                  (sum == 8)) ? 1 : 0) | \
    ((c&0x7f) << 1))

#define TWOHEATS ( nw,
n,
ne,
w,
c,
e,
sw,
s,
se   ) 

Value:

error += ((nw&0x0f) + (n&0x0f) + (ne&0x0f) + (w&0x0f) + (frob&0x0f) + (e&0x0f) + (sw&0x0f) + (s&0x0f) + (se&0x0f)); \
    result = (error >> 3) & 0x0f; \
    error &= 7; \
    error += ((nw>>4) + (n>>4) + (ne>>4) + (w>>4) + ((frob>>1)&0x0f) + (e>>4) + (sw>>4) + (s>>4) + (se>>4)); \
    result |= (error<<1) & 0xf0; \
    error &= 7;

Definition at line 3534 of file cellengine.cpp.

#define VANNEAL

Value:

( \
    (((((sum = inflation + SUM9REG(1)) > 5) || (sum == 4))) ? (total++, 1) : 0) | \
    ((c&0x7f) << 1))

#define VANNEAL8

Value:

( \
    ((((sum0 = inflation + SUM9REG(1)) > 5) || (sum0 == 4)) ? (total++, 1) : 0) | \
    ((((sum1 = inflation + (SUM9REG(2) >> 1)) > 5) || (sum1 == 4)) ? (total++, 2) : 0) | \
    ((((sum2 = inflation + (SUM9REG(4) >> 2)) > 5) || (sum2 == 4)) ? (total++, 4) : 0) | \
    ((((sum3 = inflation + (SUM9REG(8) >> 3)) > 5) || (sum3 == 4)) ? (total++, 8) : 0) | \
    ((((sum4 = inflation + (SUM9REG(16) >> 4)) > 5) || (sum4 == 4)) ? (total++, 16) : 0) | \
    ((((sum5 = inflation + (SUM9REG(32) >> 5)) > 5) || (sum5 == 4)) ? (total++, 32) : 0) | \
    ((((sum6 = inflation + (SUM9REG(64) >> 6)) > 5) || (sum6 == 4)) ? (total++, 64) : 0) | \
    ((((sum7 = inflation + (SUM9REG(128) >> 7)) > 5) || (sum7 == 4)) ? (total++, 128) : 0))

#define VON_NEUMANN

Value:

( \
    ((c & 3) << 0) | \
    ((e & 1) << 6) | \
    ((e & 2) << 1) | \
    ((w & 1) << 7) | \
    ((w & 2) << 2) | \
    ((s & 1) << 8) | \
    ((s & 2) << 3) | \
    ((n & 1) << 9) | \
    ((n & 2) << 4))


Variable Documentation

const char* ruleTables[]

Todo:
generalized parameterized heat diffusion
Todo:
bit mask of neighbors to add (9 bits)
Todo:
shift count (power of two division)
Todo:
frob offset (overall heat gain)
Todo:
pass in different masks and shifts to implement symetric 8 and 4
Todo:
neighbor heats, as well as vertical, horizontal, diagonal, and asymetric heat flow fields
Todo:
logical operations
Todo:
add pixels
Todo:
map pixels

Definition at line 28 of file ruletables.cpp.


Generated on Wed Feb 2 09:19:22 2011 for Micropolis by  doxygen 1.5.6