Data Processing
30 Jan 2012 - Dr Anton Gerdelan - apg@bth.se

Ken and Chris' Technical Report

"Artificial Unlife"

anim
  • Civilian, soldier, zombie
  • Randomise starting conditions
  • At each step animat behaviour is based on probabilities
  • Which means different outcomes at each run
  • Lots of different things that can be measured
  • ← wrote each position to step-numbered RAW image (see code)
  • converted step00XXXXX.RAW to .png to .gif with ImageMagick (or GIMP)

Output Data From Programme

C code
  // end of step printing and logging
  if (i % printerval == 0) {
    printf("%i\t%i\n", i, gMaps.survivorCount); // step # and survivors left
  }
Bash script: runs.sh
for i in {0..10000}; do
./unlife 1000 100 > result$i.txt
done
I used the parameters to mean "run for 1000 steps and print stuff every 100 steps"

Process Data

C code fragment (after tedious file I/O)
for (int i = 0; i < xvalues.size(); i++) {
  // work out sum of y values for each x value
  xvalues[i].calcSum();
  // work out mean for each x value
  xvalues[i].calcMean(count);
  // sum of sq diffs from mean
  xvalues[i].calcSumOfSqDiffs();
  // std dev
  xvalues[i].calcStdDev(count);
  // write to "stats.txt"
  fileout << xvalues[i].x << "\t" << xvalues[i].meanOfYValues
  << "\t" << xvalues[i].standardDev << endl;
}

Processed Data

Plot Data

>gnuplot
>plot "plot.xy" witherrorbars
plot

Extra

Source code, scripts, and examples from my "Artificial Unlife" demo:
unlife2.zip