#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | CA |
Represents a cellular automaton. More... | |
Defines | |
#define | IMAGE_DIRECTORY "images.temp" |
#define | PGM_FILE_PATTERN "step_%i.pgm" |
#define | JPG_FILE_PATTERN "step_%i.jpg" |
#define | VIDEO_FILENAME "CA.avi" |
#define | CA_ITERATIONS 2000 |
Functions | |
void | createVideo (int width, int height) |
void | simulate (CA *ca, int *rule) |
void | outputImages (CA *ca, int nimage) |
int * | getRule (char *file) |
Pulls a rule for the CA from a specified file. | |
CA * | getInitCA (char *file, int size) |
Pulls a CA of specified size from a file given by the specified file name. | |
void | usage () |
CA * | createCA (int size) |
Creates a new CA ready for use, all malloc'd and all. | |
void | printInternalCA (CA *ca) |
Prints to stdout our internal representation of the specified CA. | |
void | printCA (CA *ca) |
Prints to stdout the CA in its normal form. | |
int | step (CA *curr, CA *next, int *rule) |
Performs the transition for one generation of the CA to the next, based on the specified rule set. | |
void | toPGM (CA *ca, char *file) |
int | finished (CA *ca) |
Indicates whether or not a CA has been completedly classified, i.e. | |
int | main (int argc, char **argv) |
Variables | |
int | removePGMs = 1 |
Indicates whether or not to remove the PGM images that are created during the video creation process. |
#define CA_ITERATIONS 2000 |
Definition at line 13 of file makeCAvid.c.
#define IMAGE_DIRECTORY "images.temp" |
Definition at line 9 of file makeCAvid.c.
#define JPG_FILE_PATTERN "step_%i.jpg" |
Definition at line 11 of file makeCAvid.c.
#define PGM_FILE_PATTERN "step_%i.pgm" |
Definition at line 10 of file makeCAvid.c.
#define VIDEO_FILENAME "CA.avi" |
Definition at line 12 of file makeCAvid.c.
CA* createCA | ( | int | size | ) |
void createVideo | ( | int | width, | |
int | height | |||
) |
Definition at line 120 of file makeCAvid.c.
int finished | ( | CA * | ca | ) |
Indicates whether or not a CA has been completedly classified, i.e.
whether or not the CA is either all ones or all zeros.
ca | The CA for which to determine whether or not it is fully classified. |
Definition at line 232 of file makeCAvid.c.
CA* getInitCA | ( | char * | file, | |
int | size | |||
) |
Pulls a CA of specified size from a file given by the specified file name.
The CA should all be on one line and just be a string of ones and zeros with no separation.
file | The name of the file that contains the CA configuration. | |
size | The size of the CA in the file. |
Definition at line 192 of file makeCAvid.c.
int* getRule | ( | char * | file | ) |
Pulls a rule for the CA from a specified file.
The rule should be contained entirely on one line.
file | The name of the file that contains the rule. |
Definition at line 167 of file makeCAvid.c.
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 42 of file makeCAvid.c.
void outputImages | ( | CA * | ca, | |
int | nimage | |||
) |
Definition at line 142 of file makeCAvid.c.
void printCA | ( | CA * | ca | ) |
Prints to stdout the CA in its normal form.
ca | The CA to print to the screen. |
Definition at line 293 of file makeCAvid.c.
void printInternalCA | ( | CA * | ca | ) |
Prints to stdout our internal representation of the specified CA.
ca | The CA whose internal representaiton will be printed. |
Definition at line 280 of file makeCAvid.c.
void simulate | ( | CA * | ca, | |
int * | rule | |||
) |
Definition at line 95 of file makeCAvid.c.
Performs the transition for one generation of the CA to the next, based on the specified rule set.
The current CA is passed and remains unmodified, with its next generation being put into the CA, next.
curr | The current generation. | |
next | The next generation. | |
rules | The rule set that governs how a CA should be updated. |
Definition at line 307 of file makeCAvid.c.
void toPGM | ( | CA * | ca, | |
char * | file | |||
) |
Definition at line 330 of file makeCAvid.c.
void usage | ( | ) |
Definition at line 220 of file makeCAvid.c.
int removePGMs = 1 |
Indicates whether or not to remove the PGM images that are created during the video creation process.
Definition at line 25 of file makeCAvid.c.