Skip to content

Instantly share code, notes, and snippets.

View andrewrcollins's full-sized avatar

Andrew Collins andrewrcollins

View GitHub Profile
@andrewrcollins
andrewrcollins / boole1.c
Created January 5, 2012 03:38
#TJHSST ~ Random Boolean Networks
/* Random Boolean Networks */
#include <stdio.h>
/* This is a two-dimensional Boolean Network based on an X-Y system.
If the field were put geometrically it would be a toroid. */
#define MaxX 16
#define MaxY 10
/* K is the number of inputs a node has. I will use 2 for now. */
#define K 2
/* TRUE and FALSE are states, Boolean States. There are two of them. */
@andrewrcollins
andrewrcollins / mixing.c
Created January 5, 2012 03:43
#TJHSST ~ Simulate mixing process of two immiscible fluids
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# #
## ## # # # # # # ####
# # # # # # # # ## # # #
# # # # ## # # # # #
# # # ## # # # # # ###
# # # # # # # ## # #
# # # # # # # # ####
@andrewrcollins
andrewrcollins / triinput.c
Created January 5, 2012 03:54
#TJHSST ~ Mouse-Driven Triangle Input
/*
Triangle Input
*/
#include <graphics.h>
#include <math.h>
#include <string.h>
#include "mouse.h"
struct point {
long int x,y;
@andrewrcollins
andrewrcollins / corewar.h
Created January 6, 2012 02:10
#TJHSST ~ Corewar
/*------------------------------------------------------------------------*\
| C O R E W A R . H |
\*------------------------------------------------------------------------*/
/* defines used for controlling size of the Core */
#define MaxCoreSize 10
#define MaxInstruction 9
/* the modes of addressing in respect to the arguments' values */
#define Immediate 0
@andrewrcollins
andrewrcollins / decode.c
Created January 6, 2012 02:15
#TJHSST ~ Run Length Encoding
/* Run Length Decoding
An example program that decompresses the data stored in
a disk file to video memory */
#include <stdio.h>
/* the screen's beginning memory address B800:0000 */
#define ScrnMem 0xb8000000
/* with CGAs the screen takes up 4000 bytes. */
#define ScrnSize 4000
/* the escape code is the symbol which we won't see in the data we are
@andrewrcollins
andrewrcollins / julia.c
Created January 6, 2012 02:20
#TJHSST ~ Julia Set and Mandelbrot Set
#include <math.h>
#include <graphics.h>
#include <conio.h>
#include <mouse.h>
#define double long double
#define MaxRI (double)6.0
#define MaxIter 32
#define ScrX 40
@andrewrcollins
andrewrcollins / network.c
Created January 6, 2012 02:22
#TJHSST ~ Maximizing Flow in a Network
/* Maximizing Flow in a Network */
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <stdlib.h>
/* These are small for no real reason. */
#define MAXVERTEXCNT 6
#define MAXFLOW 15
#define BIGMAXFLOW (MAXFLOW*MAXFLOW)
@andrewrcollins
andrewrcollins / meander.c
Created January 6, 2012 02:27
#TJHSST ~ Meander
/*
Meander
*/
#include <stdio.h>
/* For IBMs only. */
#include "stdlib.h"
#include "graphics.h"
/* Miscellaneous defines. */
#define BOARDX 8
@andrewrcollins
andrewrcollins / rndwalk2.c
Created January 6, 2012 02:29
#TJHSST ~ Random Walks
/*
Random Walks
*/
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
#include "conio.h"
#include "graphics.h"
#define MAXX 40
@andrewrcollins
andrewrcollins / lifefast.c
Created January 6, 2012 02:30
#TJHSST ~ Game of Life
/*
"Life"
John Horton Conway's Cellular Automaton
Using meta-blocks
*/
#include <stdio.h>
/* For IBMs only. */
#include "conio.h"