Some parts of this project contain mathematical formulas, but nothing more than you have seen
in Math 165. There may be parts of this project that may be ambiguous (not on purpose), but it
is your job to also clarify program specifications given in a natural language. Please read the
assignments early and asks questions in class. Questions that lead to further specification or
changes in the project specification will be posted in Piazza or in the announcements section of
the Canvas course.
Cellular automata have long been used to model a variety of real and imaginary systems, and a
Google search on “cellular automata” will yield a plethora web sites dedicated to different forms
of cellular automata. For this part of the project we will work with one-dimensional cellular
The purpose of this part of the project is to create the infrastructure for the assignment and to do
a simple C program that will get you familiar with the process. The project is divided into
Project 1 part a
1. Remove any previous Git repositories that you have created for this class and create a
new repository named “coms327P1” Be sure to add the three TAs as maintainers to your
repository. Also remember that part of your grade will depend on README and
DEVELOPER files. Please see the syllabus.
2. Create a function named “init1DCA” that initializes a one-dimensional cellular
automaton to the quiescent, all zero state. The 1DCA is stored as an array of unsigned
char type and the parameters to the function are an int type that is the number of cells to
initialize (first parameter) and a pointer to the start of the array (second parameter). Place
this function in the file “dca1d.c”
3. Create a function named “set1DCACell” that takes three parameters. The first parameter
is a pointer to the start of the 1DCA array of unsigned characters, the second is int an
index into that array, and the third is an unsigned char value that is the state to set the
indexed cell. As much as possible this function should validate its input. At this point in
time, you may only be able to check if the index is negative. Further refinements of the
code in future parts will allow much better error parameter validation. The idea here is
that a call to this function allows the client to set the specified cell to a specified state.
Place this function in the file “dca1d.c”
4. Create a function name “display1DCA” that outputs the current state of the 1DCA. The
function takes two parameters. The first parameter is a pointer to the start of the 1DCA
array, and the second parameter is the number of cells in the 1DCA. Each cell state is
separated by a space and terminated with an end of line character (\n). The left must
printed cell is at index 0. Place this function in the file “dca1d.c”
5. Create a header file named “dca1d.h” that creates correct prototypes for the functions
defined in 2, 3, and 4. Be sure to include correct guards for the header file.
6. Create a main program that creates a 1DCA that is 25 cells wide and initializes all of the
odd cell indices to 1 and all of the even cell indices to 2. It then prints the current state of
the 1DCA after it is initialized.
7. Create a makefile for this project so that when a user types make in the top directory for
the repository, the executable program named “odca” is created and runs the main
program defined in 6.
8. 10% points come from documentation and following the syllabus requirements for