Monday January 11, 2016
You task is to modify an existing C program to output data in comma-separated value (CSV) format.
The starter code is provided below in the "Langton's Ant CSV starter zip file". Your task is to modify the code such that it outputs a file in CSV format for each time step of the simulation. Each CSV file should contain the following heading.


Following the heading, the file should contain corresponding X, Y, and State data for each cell in the automaton, e.g.:


The state of each cell should be written as a 1 if the cell is white and a 0 if the cell is black.

The name of each file should be langtonX.csv, where X is the timestep.

Your program can use the C functions fopen(), fclose(), and fprintf() to handle file I/O; these are all available as part of the stdio.h header file.

The starter code is based on code from previous challenge problems found at the links below.
Show solution
Challenge Resources:
©1994-2022   |   Shodor   |   Privacy Policy   |   NSDL   |   XSEDE   |   Blue Waters   |   ACM SIGHPC   |   feedback  |   facebook   |   twitter   |   rss   |   youtube   |   XSEDE Code of Conduct   |   Not Logged In. Login